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