Re: FreeBSD mostly OK. [nwc10@colon.colondot.net: Report /export/home/nwc10/Even...
[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';
6 @INC = '../lib';
7}
8
9use Cwd;
10use Test::More tests => 2;
11
12# The normal kill() trick is not portable.
13sub is_tainted {
14 return ! eval { eval("#" . substr(join("", @_), 0, 0)); 1 };
15}
16
17my $cwd;
18eval { $cwd = getcwd; };
19is( $@, '', 'getcwd() does not explode under taint mode' );
88587957 20ok( is_tainted($cwd), "its return value is tainted" );
ea715489 21