This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
Whether overwriting the $self->{...} values (see #12902)
[perl5.git] / lib / warnings.t
index 09b41fb..b6daebc 100644 (file)
@@ -21,9 +21,9 @@ my @prgs = () ;
 my @w_files = () ;
 
 if (@ARGV)
-  { print "ARGV = [@ARGV]\n" ; @w_files = map { s#^#./pragma/warn/#; $_ } @ARGV }
+  { print "ARGV = [@ARGV]\n" ; @w_files = map { s#^#./lib/warnings/#; $_ } @ARGV }
 else
-  { @w_files = sort glob("pragma/warn/*") }
+  { @w_files = sort glob("lib/warnings/*") }
 
 my $files = 0;
 foreach my $file (@w_files) {
@@ -81,20 +81,35 @@ for (@prgs){
        $prog = shift @files ;
     }
     open TEST, ">$tmpfile";
+    print TEST q{
+        BEGIN { 
+            open(STDERR, ">&STDOUT") 
+              or die "Can't dup STDOUT->STDERR: $!;";
+        }
+    };
+    print TEST "\n#line 1\n";  # So the line numbers don't get messed up.
     print TEST $prog,"\n";
     close TEST;
     my $results = $Is_VMS ?
-                  `./perl "-I../lib" $switch $tmpfile 2>&1` :
+                     `./perl "-I../lib" $switch $tmpfile` :
                  $Is_MSWin32 ?
-                  `.\\perl -I../lib $switch $tmpfile 2>&1` :
+                     `.\\perl -I../lib $switch $tmpfile` :
                  $Is_NetWare ?
-                  `perl -I../lib $switch $tmpfile 2>&1` :
-                  `./perl -I../lib $switch $tmpfile 2>&1`;
+                     `perl -I../lib $switch $tmpfile` :
+                 $Is_MacOS ?
+                     `$^X -I::lib $switch -MMac::err=unix $tmpfile` :
+                  `./perl -I../lib $switch $tmpfile`;
     my $status = $?;
     $results =~ s/\n+$//;
     # allow expected output to be written as if $prog is on STDIN
     $results =~ s/tmp\d+/-/g;
-    $results =~ s/\n%[A-Z]+-[SIWEF]-.*$// if $Is_VMS;  # clip off DCL status msg
+    if ($^O eq 'VMS') {
+        # some tests will trigger VMS messages that won't be expected
+        $results =~ s/\n?%[A-Z]+-[SIWEF]-[A-Z]+,.*//;
+
+        # pipes double these sometimes
+        $results =~ s/\n\n/\n/g;
+    }
 # bison says 'parse error' instead of 'syntax error',
 # various yaccs may or may not capitalize 'syntax'.
     $results =~ s/^(syntax|parse) error/syntax error/mig;