Opening dirhandle DIR also as a file needs no warnings 'deprecated';
[p5sagit/p5-mst-13.2.git] / t / op / runlevel.t
old mode 100755 (executable)
new mode 100644 (file)
index fffe103..8b0429f
@@ -8,10 +8,10 @@
 
 chdir 't' if -d 't';
 @INC = '../lib';
+require './test.pl';
 $Is_VMS = $^O eq 'VMS';
 $Is_MSWin32 = $^O eq 'MSWin32';
 $Is_NetWare = $^O eq 'NetWare';
-$Is_MacOS = $^O eq 'MacOS';
 $ENV{PERL5LIB} = "../lib" unless $Is_VMS;
 
 $|=1;
@@ -20,9 +20,7 @@ undef $/;
 @prgs = split "\n########\n", <DATA>;
 print "1..", scalar @prgs, "\n";
 
-$tmpfile = "runltmp000";
-1 while -f ++$tmpfile;
-END { if ($tmpfile) { 1 while unlink $tmpfile; } }
+$tmpfile = tempfile();
 
 for (@prgs){
     my $switch = "";
@@ -34,18 +32,16 @@ for (@prgs){
     print TEST "$prog\n";
     close TEST or die "Could not close: $!";
     my $results = $Is_VMS ?
-                      `MCR $^X "-I[-.lib]" $switch $tmpfile 2>&1` :
+                      `$^X "-I[-.lib]" $switch $tmpfile 2>&1` :
                  $Is_MSWin32 ?  
                      `.\\perl -I../lib $switch $tmpfile 2>&1` :
                  $Is_NetWare ?  
                      `perl -I../lib $switch $tmpfile 2>&1` :
-                 $Is_MacOS ?
-                     `$^X -I::lib -MMac::err=unix $switch $tmpfile` :
                  `./perl $switch $tmpfile 2>&1`;
     my $status = $?;
     $results =~ s/\n+$//;
     # allow expected output to be written as if $prog is on STDIN
-    $results =~ s/runltmp\d+/-/g;
+    $results =~ s/$::tempfile_regexp/-/ig;
     $results =~ s/\n%[A-Z]+-[SIWEF]-.*$// if $Is_VMS;  # clip off DCL status msg
     $expected =~ s/\n+$//;
     if ($results ne $expected) {
@@ -374,3 +370,36 @@ sub d {
 }
 EXPECT
 0
+########
+sub TIEHANDLE { bless {} }
+sub PRINT { next }
+
+tie *STDERR, '';
+{ map ++$_, 1 }
+
+EXPECT
+Can't "next" outside a loop block at - line 2.
+########
+sub TIEHANDLE { bless {} }
+sub PRINT { print "[TIE] $_[1]" }
+
+tie *STDERR, '';
+die "DIE\n";
+
+EXPECT
+[TIE] DIE
+########
+sub TIEHANDLE { bless {} }
+sub PRINT { 
+    (split(/./, 'x'x10000))[0];
+    eval('die("test\n")');
+    warn "[TIE] $_[1]";
+}
+open OLDERR, '>&STDERR';
+tie *STDERR, '';
+
+use warnings FATAL => qw(uninitialized);
+print undef;
+
+EXPECT
+[TIE] Use of uninitialized value in print at - line 11.