diff options
author | Nicholas Clark <nick@ccl4.org> | 2013-07-03 10:57:28 +0200 |
---|---|---|
committer | Nicholas Clark <nick@ccl4.org> | 2013-07-05 20:26:25 +0200 |
commit | e12eeff833d221009aa2e2a6d745f2c1812f2f77 (patch) | |
tree | 3e3929715b272175729ab4a99a67a4f389d5ccda /lib/File | |
parent | 05bc6e4e004001cec69ec60de3c2ccd2c84c6484 (diff) | |
download | perl-e12eeff833d221009aa2e2a6d745f2c1812f2f77.tar.gz |
Change File::Find's tests to look for taint.t instead of commonsense.t
This passes whether the tests are in lib/ (and hence run with the CWD as t/)
or in ext/File-Find (and hence run with that as the CWD) because they find
t/op/taint.t or ext/File-Find/t/taint.t respectively.
Change taint.t to count the number of times it finds a file named taint.t,
and fail if the count isn't 1. find.t was already testing a count.
Diffstat (limited to 'lib/File')
-rw-r--r-- | lib/File/Find/t/find.t | 16 | ||||
-rw-r--r-- | lib/File/Find/t/taint.t | 8 |
2 files changed, 12 insertions, 12 deletions
diff --git a/lib/File/Find/t/find.t b/lib/File/Find/t/find.t index 53ba648ad7..62ec81e947 100644 --- a/lib/File/Find/t/find.t +++ b/lib/File/Find/t/find.t @@ -57,22 +57,22 @@ my $orig_dir = cwd(); cleanup(); -$::count_commonsense = 0; -find({wanted => sub { ++$::count_commonsense if $_ eq 'commonsense.t'; } }, +$::count_taint = 0; +find({wanted => sub { ++$::count_taint if $_ eq 'taint.t'; } }, File::Spec->curdir); -if ($::count_commonsense == 1) { +if ($::count_taint == 1) { print "ok 1\n"; } else { - print "not ok 1 # found $::count_commonsense files named 'commonsense.t'\n"; + print "not ok 1 # found $::count_taint files named 'taint.t'\n"; } -$::count_commonsense = 0; -finddepth({wanted => sub { ++$::count_commonsense if $_ eq 'commonsense.t'; } }, +$::count_taint = 0; +finddepth({wanted => sub { ++$::count_taint if $_ eq 'taint.t'; } }, File::Spec->curdir); -if ($::count_commonsense == 1) { +if ($::count_taint == 1) { print "ok 2\n"; } else { - print "not ok 2 # found $::count_commonsense files named 'commonsense.t'\n"; + print "not ok 2 # found $::count_taint files named 'taint.t'\n"; } my $case = 2; diff --git a/lib/File/Find/t/taint.t b/lib/File/Find/t/taint.t index d6fb256993..9d78ae0632 100644 --- a/lib/File/Find/t/taint.t +++ b/lib/File/Find/t/taint.t @@ -60,16 +60,16 @@ my $orig_dir = cwd(); cleanup(); my $found; -find({wanted => sub { $found = 1 if ($_ eq 'commonsense.t') }, +find({wanted => sub { ++$found if $_ eq 'taint.t' }, untaint => 1, untaint_pattern => qr|^(.+)$|}, File::Spec->curdir); -ok($found, 'commonsense.t found'); +is($found, 1, 'taint.t found once'); $found = 0; -finddepth({wanted => sub { $found = 1 if $_ eq 'commonsense.t'; }, +finddepth({wanted => sub { ++$found if $_ eq 'taint.t'; }, untaint => 1, untaint_pattern => qr|^(.+)$|}, File::Spec->curdir); -ok($found, 'commonsense.t found again'); +is($found, 1, 'taint.t found once again'); my $case = 2; my $FastFileTests_OK = 0; |