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