r27459 - /trunk/dh-make-perl/t/Strange-0.1.t

dmn at users.alioth.debian.org dmn at users.alioth.debian.org
Sun Nov 30 11:03:55 UTC 2008


Author: dmn
Date: Sun Nov 30 11:03:52 2008
New Revision: 27459

URL: http://svn.debian.org/wsvn/pkg-perl/?sc=1&rev=27459
Log:
Strange.t now can run tests for many dists

Modified:
    trunk/dh-make-perl/t/Strange-0.1.t

Modified: trunk/dh-make-perl/t/Strange-0.1.t
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/dh-make-perl/t/Strange-0.1.t?rev=27459&op=diff
==============================================================================
--- trunk/dh-make-perl/t/Strange-0.1.t (original)
+++ trunk/dh-make-perl/t/Strange-0.1.t Sun Nov 30 11:03:52 2008
@@ -7,35 +7,50 @@
 
 use FindBin qw($Bin);
 
-my $dist = "$Bin/dists/Strange-0.1";
+sub compare {
+
+    return unless -f $File::Find::name;
+
+    my $wanted = $File::Find::name;
+    $wanted =~ s{/debian/}{/wanted-debian/};
+    my $diff = diff($wanted, $File::Find::name);
+
+    $diff = ''
+        unless grep { /^[-+] /
+                     and not /^[-+] -- Joe Maintainer <joemaint\@test.local>  / }
+            split( /\n/, $diff );
+
+    is($diff, '', "$File::Find::name is OK");
+}
+
+sub dist_ok($) {
+    my $dist_dir = shift;
+    my $dist = "$Bin/dists/$dist_dir";
+
+    system( "$Bin/../dh-make-perl", "--no-verbose",
+            "--home-dir", "$Bin/contents", "--sources-list",
+            "$Bin/contents/sources.list", "--email", "joemaint\@test.local",
+            $dist );
+
+    is( $?, 0, "$dist_dir: system returned 0" );
+
+    use File::Find qw(find);
+    use Text::Diff qw(diff);
+
+    find(\&compare, "$dist/debian");
+
+    # clean after the test
+    find( sub{
+            unlink $File::Find::name 
+                or die "unlink($File::Find::name): $!"
+            if -f $File::Find::name;
+        }, "$dist/debian" );
+
+    rmdir "$dist/debian" or die "rmdir($dist/debian): $!";
+}
 
 $ENV{DEBFULLNAME} = "Joe Maintainer";
-system( "$Bin/../dh-make-perl", "--no-verbose",
-        "--home-dir", "$Bin/contents", "--sources-list",
-        "$Bin/contents/sources.list", "--email", "joemaint\@test.local",
-        $dist );
 
-is( $?, 0, 'system returned 0' );
-
-use File::Find qw(find);
-use Text::Diff qw(diff);
-
-find(\&compare, "$dist/debian");
-
-sub compare
-{
-    return unless -f $File::Find::name;
-
-    my $diff = diff("$dist/wanted-debian/$_", $File::Find::name);
-
-    $diff = ''
-        unless grep { /^[-+] / and not /^[-+] -- Joe Maintainer / }
-            split( /\n/, $diff );
-
-    is($diff, '', "No differences to the wanted contents of debian/$_");
+for( qw( Strange-0.1 ) ) {
+    dist_ok($_);
 }
-
-# clean after the test
-find( sub{ unlink $File::Find::name }, "$dist/debian" );
-
-rmdir "$dist/debian" or warn "Error removing $dist/debian: $!\n";




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