use Config;
use File::Spec::Functions;
+my $total_tests = 236;
my $test = 177;
sub ok ($;$) {
my($ok, $name) = @_;
my $TEST = catfile(curdir(), 'TEST');
-print "1..220\n";
+print "1..$total_tests\n";
# First, let's make sure that Perl is checking the dangerous
# environment variables. Maybe they aren't set yet, so we'll
if ($Is_Cygwin && ! -f 'cygwin1.dll') {
system("/usr/bin/cp /usr/bin/cygwin1.dll .") &&
die "$0: failed to cp cygwin1.dll: $!\n";
- END { unlink "cygwin1.dll" } # yes, done for all platforms...
+ eval q{
+ END { unlink "cygwin1.dll" }
+ };
+ }
+
+ if ($Is_Cygwin && ! -f 'cygcrypt-0.dll' && -f '/usr/bin/cygcrypt-0.dll') {
+ system("/usr/bin/cp /usr/bin/cygcrypt-0.dll .") &&
+ die "$0: failed to cp cygcrypt-0.dll: $!\n";
+ eval q{
+ END { unlink "cygcrypt-0.dll" }
+ };
}
test 1, eval { `$echo 1` } eq "1\n";
test 219, !tainted($1);
($r = $TAINT) =~ /($TAINT)/;
test 220, tainted($1);
+
+ # [perl #24674]
+ # accessing $^O shoudn't taint it as a side-effect;
+ # assigning tainted data to it is now an error
+
+ test 221, !tainted($^O);
+ if (!$^X) { } elsif ($^O eq 'bar') { }
+ test 222, !tainted($^O);
+ eval '$^O = $^X';
+ test 223, $@ =~ /Insecure dependency in/;
+}
+
+EFFECTIVELY_CONSTANTS: {
+ my $tainted_number = 12 + $TAINT0;
+ test 224, tainted( $tainted_number );
+
+ # Even though it's always 0, it's still tainted
+ my $tainted_product = $tainted_number * 0;
+ test 225, tainted( $tainted_product );
+ test 226, $tainted_product == 0;
+}
+
+TERNARY_CONDITIONALS: {
+ my $tainted_true = $TAINT . "blah blah blah";
+ my $tainted_false = $TAINT0;
+ test 227, tainted( $tainted_true );
+ test 228, tainted( $tainted_false );
+
+ my $result = $tainted_true ? "True" : "False";
+ test 229, $result eq "True";
+ test 230, !tainted( $result );
+
+ $result = $tainted_false ? "True" : "False";
+ test 231, $result eq "False";
+ test 232, !tainted( $result );
+
+ my $untainted_whatever = "The Fabulous Johnny Cash";
+ my $tainted_whatever = "Soft Cell" . $TAINT;
+
+ $result = $tainted_true ? $tainted_whatever : $untainted_whatever;
+ test 233, $result eq "Soft Cell";
+ test 234, tainted( $result );
+
+ $result = $tainted_false ? $tainted_whatever : $untainted_whatever;
+ test 235, $result eq "The Fabulous Johnny Cash";
+ test 236, !tainted( $result );
}