r27340 - /trunk/dh-make-perl/t/AptContents.t
dmn at users.alioth.debian.org
dmn at users.alioth.debian.org
Thu Nov 27 09:51:07 UTC 2008
Author: dmn
Date: Thu Nov 27 09:51:04 2008
New Revision: 27340
URL: http://svn.debian.org/wsvn/pkg-perl/?sc=1&rev=27340
Log:
AptContents.t: ease creation of AptContents instances
Modified:
trunk/dh-make-perl/t/AptContents.t
Modified: trunk/dh-make-perl/t/AptContents.t
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/dh-make-perl/t/AptContents.t?rev=27340&op=diff
==============================================================================
--- trunk/dh-make-perl/t/AptContents.t (original)
+++ trunk/dh-make-perl/t/AptContents.t Thu Nov 27 09:51:04 2008
@@ -12,20 +12,27 @@
unlink("$Bin/Contents.cache");
+sub instance
+{
+ AptContents->new({
+ homedir => $Bin,
+ contents_dir => "$Bin/contents",
+ verbose => 0,
+ sources_file => "$Bin/contents/sources.list",
+ @_,
+ });
+}
+
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' }
-);
+my $apt_contents = instance( 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 }
-);
+$apt_contents = instance();
isnt( $apt_contents, undef, 'object created' );
@@ -39,18 +46,14 @@
is( $apt_contents->source, 'parsed files', 'no cache was used' );
-$apt_contents = AptContents->new(
- { homedir => $Bin, contents_dir => "$Bin/contents", verbose => 0 }
-);
+$apt_contents = instance();
is( $apt_contents->source, 'cache', 'cache was used' );
sleep(1); # allow the clock to tick so the timestamp actually differs
touch( glob "$Bin/contents/*Contents*" );
-$apt_contents = AptContents->new(
- { homedir => $Bin, contents_dir => "$Bin/contents", verbose => 0 }
-);
+$apt_contents = instance();
is( $apt_contents->source, 'parsed files', 'cache updated' );
More information about the Pkg-perl-cvs-commits
mailing list