Upgrade to PathTools 3.07
[p5sagit/p5-mst-13.2.git] / ext / Cwd / t / taint.t
CommitLineData
ea715489 1#!./perl -Tw
2# Testing Cwd under taint mode.
3
99f36a73 4use strict;
5
ea715489 6BEGIN {
39f7733f 7 if ($ENV{PERL_CORE}) {
99f36a73 8 chdir 't';
9 @INC = '../lib';
39f7733f 10 }
ea715489 11}
39f7733f 12use Cwd;
99f36a73 13chdir 't';
ea715489 14
99f36a73 15use File::Spec;
16use lib File::Spec->catdir('t', 'lib');
60598624 17use Test::More tests => 17;
99f36a73 18
248785eb 19use Scalar::Util qw/tainted/;
ea715489 20
3ee63918 21my @Functions = qw(getcwd cwd fastcwd fastgetcwd
22 abs_path fast_abs_path
23 realpath fast_realpath
24 );
248785eb 25
3ee63918 26foreach my $func (@Functions) {
27 no strict 'refs';
28 my $cwd;
29 eval { $cwd = &{'Cwd::'.$func} };
a9939470 30 is( $@, '', "$func() should not explode under taint mode" );
31 ok( tainted($cwd), "its return value should be tainted" );
3ee63918 32}
60598624 33
34# Previous versions of Cwd tainted $^O
35is !tainted($^O), 1, "\$^O should not be tainted";