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