Commit | Line | Data |
---|---|---|
ea715489 | 1 | #!./perl -Tw |
2 | # Testing Cwd under taint mode. | |
3 | ||
a9939470 | 4 | use Cwd; |
ea715489 | 5 | BEGIN { |
6 | chdir 't' if -d 't'; | |
ea715489 | 7 | } |
8 | ||
3ee63918 | 9 | use strict; |
3ee63918 | 10 | use Test::More tests => 16; |
248785eb | 11 | use Scalar::Util qw/tainted/; |
ea715489 | 12 | |
3ee63918 | 13 | my @Functions = qw(getcwd cwd fastcwd fastgetcwd |
14 | abs_path fast_abs_path | |
15 | realpath fast_realpath | |
16 | ); | |
248785eb | 17 | |
3ee63918 | 18 | foreach my $func (@Functions) { |
19 | no strict 'refs'; | |
20 | my $cwd; | |
21 | eval { $cwd = &{'Cwd::'.$func} }; | |
a9939470 | 22 | is( $@, '', "$func() should not explode under taint mode" ); |
23 | ok( tainted($cwd), "its return value should be tainted" ); | |
3ee63918 | 24 | } |