X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=blobdiff_plain;f=t%2Fop%2Ftaint.t;h=7f9d06e03743f95d6d06f6ef474ff4539018d8bc;hb=27cc343c4fb8030e5afb7c3824647d9e5e1d08d6;hp=26f9587e8527028acfc1595ca592e1e9b781477b;hpb=25fb98c0239ba605154cf0c1170f623764cf67ed;p=p5sagit%2Fp5-mst-13.2.git diff --git a/t/op/taint.t b/t/op/taint.t index 26f9587..7f9d06e 100755 --- a/t/op/taint.t +++ b/t/op/taint.t @@ -17,7 +17,7 @@ use Config; use File::Spec::Functions; BEGIN { require './test.pl'; } -plan tests => 238; +plan tests => 244; $| = 1; @@ -134,6 +134,23 @@ my $TEST = catfile(curdir(), 'TEST'); { $ENV{'DCL$PATH'} = '' if $Is_VMS; + if ($Is_MSWin32 && $Config{ccname} =~ /bcc32/ && ! -f 'cc3250mt.dll') { + my $bcc_dir; + foreach my $dir (split /$Config{path_sep}/, $ENV{PATH}) { + if (-f "$dir/cc3250mt.dll") { + $bcc_dir = $dir and last; + } + } + if (defined $bcc_dir) { + require File::Copy; + File::Copy::copy("$bcc_dir/cc3250mt.dll", '.') or + die "$0: failed to copy cc3250mt.dll: $!\n"; + eval q{ + END { unlink "cc3250mt.dll" } + }; + } + } + $ENV{PATH} = ''; delete @ENV{@MoreEnv}; $ENV{TERM} = 'dumb'; @@ -1089,3 +1106,32 @@ TERNARY_CONDITIONALS: { test not any_tainted @bar; } } + +# at scope exit, a restored localised value should have its old +# taint status, not the taint status of the current statement + +{ + our $x99 = $^X; + test tainted $x99; + + $x99 = ''; + test not tainted $x99; + + my $c = do { local $x99; $^X }; + test not tainted $x99; +} +{ + our $x99 = $^X; + test tainted $x99; + + my $c = do { local $x99; '' }; + test tainted $x99; +} + +# an mg_get of a tainted value during localization shouldn't taint the +# statement + +{ + eval { local $0, eval '1' }; + test $@ eq ''; +}