summaryrefslogtreecommitdiffstats
path: root/gnu/usr.bin/perl/cpan/version/t/11_taint.t
blob: 5307b01268a55e5f93c5d765a9822bd3350e1e9b (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
#!perl -T
use Test::More;
use version;

BEGIN {
    eval "use Test::Taint";
    if ($@) {
	plan skip_all => "No Test::Taint available";
    } else {
	plan tests => 6;
    }
}

taint_checking_ok();
my $v = 'v1.2.3';
taint($v);
tainted_ok($v, 'Set string as tainted');
my $v2 = version->parse($v);
isnt("$v2", '', 'Correctly parsed the tainted string');
tainted_ok($v2, 'Resulting version object is tainted');

my $vs = "$v2";
tainted_ok($vs, 'Stringified object still tainted');
is $v2, 'v1.2.3', 'Comparison to tainted object';