summaryrefslogtreecommitdiff
path: root/ext/Cwd/t/taint.t
blob: 2cd7d19ae61a5a3d3efa2e3fa6e9a073d1a05b6b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
#!./perl -Tw
# Testing Cwd under taint mode.

BEGIN {
    chdir 't' if -d 't';
    unshift @INC, '../lib';
}

use strict;
use Cwd;
use Test::More tests => 16;
use Scalar::Util qw/tainted/;

my @Functions = qw(getcwd cwd fastcwd fastgetcwd
                   abs_path fast_abs_path
                   realpath fast_realpath
                  );

foreach my $func (@Functions) {
    no strict 'refs';
    my $cwd;
    eval { $cwd = &{'Cwd::'.$func} };
    is( $@, '',		"$func() does not explode under taint mode" );
    ok( tainted($cwd),	"its return value is tainted" );
}