xref: /openbsd/gnu/usr.bin/perl/cpan/version/t/11_taint.t (revision 3cab2bb3)
1#!perl -T
2use Test::More;
3use version;
4
5BEGIN {
6    eval "use Test::Taint";
7    if ($@) {
8	plan skip_all => "No Test::Taint available";
9    } else {
10	plan tests => 6;
11    }
12}
13
14taint_checking_ok();
15my $v = 'v1.2.3';
16taint($v);
17tainted_ok($v, 'Set string as tainted');
18my $v2 = version->parse($v);
19isnt("$v2", '', 'Correctly parsed the tainted string');
20tainted_ok($v2, 'Resulting version object is tainted');
21
22my $vs = "$v2";
23tainted_ok($vs, 'Stringified object still tainted');
24is $v2, 'v1.2.3', 'Comparison to tainted object';
25