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