r27334 - /trunk/dh-make-perl/t/AptContents.t

dmn at users.alioth.debian.org dmn at users.alioth.debian.org
Thu Nov 27 08:34:59 UTC 2008


Author: dmn
Date: Thu Nov 27 08:34:57 2008
New Revision: 27334

URL: http://svn.debian.org/wsvn/pkg-perl/?sc=1&rev=27334
Log:
add tests for the AptContents class

Added:
    trunk/dh-make-perl/t/AptContents.t   (with props)

Added: trunk/dh-make-perl/t/AptContents.t
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/dh-make-perl/t/AptContents.t?rev=27334&op=file
==============================================================================
--- trunk/dh-make-perl/t/AptContents.t (added)
+++ trunk/dh-make-perl/t/AptContents.t Thu Nov 27 08:34:57 2008
@@ -1,0 +1,39 @@
+#!/usr/bin/perl -w
+
+use strict;
+use warnings;
+
+use Test::More 'no_plan';
+
+use FindBin qw($Bin);
+
+require "$Bin/../dh-make-perl";        # Load our code for testing.
+
+unlink("$Bin/Contents.cache");
+
+eval { AptContents->new() };
+ok( $@, 'AptContents->new with no homedir dies' );
+like( $@, qr/No homedir given/, 'should say why it died' );
+
+my $apt_contents = AptContents->new(
+    { homedir => '.', contents_dir => 'non-existent' }
+);
+
+is( $apt_contents, undef, 'should not create with no contents' );
+
+
+$apt_contents = AptContents->new(
+    { homedir => $Bin, contents_dir => "$Bin/contents", verbose => 0 }
+);
+
+isnt( $apt_contents, undef, 'object created' );
+
+is_deeply(
+    $apt_contents->contents_files,
+    [ sort glob "$Bin/contents/*Contents*" ],
+    'contents in a dir'
+);
+
+ok( -f "$Bin/Contents.cache", 'Contents.cache created' );
+
+ok( unlink "$Bin/Contents.cache", 'Contents.cache unlnked' );

Propchange: trunk/dh-make-perl/t/AptContents.t
------------------------------------------------------------------------------
    svn:executable = *




More information about the Pkg-perl-cvs-commits mailing list