File/Find/t/find.t tests 1 and 2 (was Re: [perl #17061] no strict 'garbage')
Nicholas Clark [Sun, 8 Sep 2002 19:45:52 +0000 (20:45 +0100)]
Message-ID: <20020908184551.GH286@Bagpuss.unfortu.net>

p4raw-id: //depot/perl@17884

lib/File/Find/t/find.t

index c281833..4e5a217 100644 (file)
@@ -51,12 +51,23 @@ BEGIN {
 
 cleanup();
 
-find({wanted => sub { print "ok 1\n" if $_ eq 'commonsense.t'; } },
+$::count_commonsense = 0;
+find({wanted => sub { ++$::count_commonsense if $_ eq 'commonsense.t'; } },
    File::Spec->curdir);
+if ($::count_commonsense == 1) {
+  print "ok 1\n";
+} else {
+  print "not ok 1 # found $::count_commonsense files named 'commonsense.t'\n";
+}
 
-finddepth({wanted => sub { print "ok 2\n" if $_ eq 'commonsense.t'; } },
+$::count_commonsense = 0;
+finddepth({wanted => sub { ++$::count_commonsense if $_ eq 'commonsense.t'; } },
        File::Spec->curdir);
-
+if ($::count_commonsense == 1) {
+  print "ok 2\n";
+} else {
+  print "not ok 2 # found $::count_commonsense files named 'commonsense.t'\n";
+}
 
 my $case = 2;
 my $FastFileTests_OK = 0;