Taint problems in Cwd::abs_path
[p5sagit/p5-mst-13.2.git] / ext / Cwd / t / taint.t
1 #!./perl -Tw
2 # Testing Cwd under taint mode.
3
4 BEGIN {
5     chdir 't' if -d 't';
6     unshift @INC, '../lib';
7 }
8
9 use strict;
10 use Cwd;
11 use Test::More tests => 16;
12 use Scalar::Util qw/tainted/;
13
14 my @Functions = qw(getcwd cwd fastcwd fastgetcwd
15                    abs_path fast_abs_path
16                    realpath fast_realpath
17                   );
18
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 }