dup saved_curcop in PL_parser
[p5sagit/p5-mst-13.2.git] / t / run / switcht.t
index 2ac9ed0..fd81885 100644 (file)
@@ -6,7 +6,7 @@ BEGIN {
     require './test.pl';
 }
 
-plan tests => 11;
+plan tests => 13;
 
 my $Perl = which_perl();
 
@@ -14,23 +14,24 @@ my $warning;
 local $SIG{__WARN__} = sub { $warning = join "\n", @_; };
 my $Tmsg = 'while running with -t switch';
 
-ok( ${^TAINT},      '${^TAINT} defined' );
+is( ${^TAINT}, -1, '${^TAINT} == -1' );
 
-my $out = `$Perl -le "print q{Hello}"`;
+my $out = `$Perl -le "print q(Hello)"`;
 is( $out, "Hello\n",                      '`` worked' );
 like( $warning, qr/^Insecure .* $Tmsg/, '    taint warn' );
 
 {
     no warnings 'taint';
     $warning = '';
-    my $out = `$Perl -le "print q{Hello}"`;
+    my $out = `$Perl -le "print q(Hello)"`;
     is( $out, "Hello\n",                      '`` worked' );
     is( $warning, '',                       '   no warnings "taint"' );
 }
 
 # Get ourselves a tainted variable.
+my $filename = tempfile();
 $file = $0;
-$file =~ s/.*/some.tmp/;
+$file =~ s/.*/$filename/;
 ok( open(FILE, ">$file"),   'open >' ) or DIE $!;
 print FILE "Stuff\n";
 close FILE;
@@ -43,3 +44,23 @@ like( $warning, qr/^Insecure dependency in unlink $Tmsg/,
 ok( !-e $file,  'unlink worked' );
 
 ok( !$^W,   "-t doesn't enable regular warnings" );
+
+
+mkdir('ttdir');
+open(FH,'>','ttdir/ttest.pl')or DIE $!;
+print FH 'return 42';
+close FH or DIE $!;
+
+SKIP: {
+    ($^O eq 'MSWin32') || skip('skip tainted do test with \ separator');
+    my $test = 0;
+    $test =  do '.\ttdir/ttest.pl';
+    is($test, 42, 'Could "do" .\ttdir/ttest.pl');
+}
+{
+    my $test = 0;
+    $test =  do './ttdir/ttest.pl';
+    is($test, 42, 'Could "do" ./ttdir/ttest.pl');
+}
+unlink ('./ttdir/ttest.pl');
+rmdir ('ttdir');