Actually submit previous change.
[p5sagit/p5-mst-13.2.git] / t / lib / warnings / pp_sys
index e30637b..173d0d8 100644 (file)
@@ -83,9 +83,6 @@
     flock STDIN, 8;
     flock $a, 8;
 
-  The stat preceding lstat() wasn't an lstat %s        [pp_stat]
-    lstat(STDIN);
-
   warn(warn_nl, "stat");                       [pp_stat]
 
   -T on closed filehandle %s
        my $file = "./xcv" ;
        open(F, ">$file") ; 
        my $a = sysread(F, $a,10) ;
-  
-  
+
+  lstat on filehandle %s                       [pp_lstat]
+
+  getc() on unopened filehandle                        [pp_getc]
+
+  getc() on closed filehandle                  [pp_getc]
+
+  Non-string passed as bitmask                 [pp_sselect]
 
 __END__
 # pp_sys.c [pp_untie]
@@ -347,24 +350,6 @@ stat "abc\ndef";
 EXPECT
 Unsuccessful stat on filename containing newline at - line 3.
 ########
-# pp_sys.c [pp_stat]
-use Config; 
-BEGIN { 
-  if ($^O eq 'd_lstat') {
-    print <<EOM ;
-SKIPPED
-# lstat not present
-EOM
-    exit ;
-  } 
-}
-use warnings 'io' ;
-lstat(STDIN) ;
-no warnings 'io' ;
-lstat(STDIN) ;
-EXPECT
-The stat preceding lstat() wasn't an lstat at - line 13.
-########
 # pp_sys.c [pp_fttext]
 use warnings qw(unopened closed) ;
 close STDIN ; 
@@ -406,9 +391,18 @@ my $a = sysread(F, $a,10) ;
 no warnings 'io' ;
 my $a = sysread(F, $a,10) ;
 close F ;
+use warnings 'io' ;
+sysread(F, $a, 10);
+read(F, $a, 10);
+sysread(NONEXISTENT, $a, 10);
+read(NONEXISTENT, $a, 10);
 unlink $file ;
 EXPECT
 Filehandle F opened only for output at - line 12.
+sysread() on closed filehandle F at - line 17.
+read() on closed filehandle F at - line 18.
+sysread() on unopened filehandle NONEXISTENT at - line 19.
+read() on unopened filehandle NONEXISTENT at - line 20.
 ########
 # pp_sys.c [pp_binmode]
 use warnings 'unopened' ;
@@ -417,3 +411,78 @@ $a = "BLERG";binmode($a);
 EXPECT
 binmode() on unopened filehandle BLARG at - line 3.
 binmode() on unopened filehandle at - line 4.
+########
+# pp_sys.c [pp_lstat]
+use warnings 'io';
+open FH, "harness" or die "# $!";
+lstat FH;
+open my $fh, $0 or die "# $!";
+lstat $fh;
+no warnings 'io';
+lstat FH;
+lstat $fh;
+close FH;
+close $fh;
+EXPECT
+lstat() on filehandle FH at - line 4.
+lstat() on filehandle $fh at - line 6.
+########
+# pp_sys.c [pp_getc]
+use warnings qw(unopened closed) ;
+getc FOO;
+close STDIN;
+getc STDIN;
+# Create an empty file
+$file = 'getcwarn.tmp';
+open FH1, ">$file" or die "# $!"; close FH1;
+open FH2, $file    or die "# $!";
+getc FH2; # Should not warn at EOF
+close FH2;
+getc FH2; # Warns, now
+unlink $file;
+no warnings qw(unopened closed) ;
+getc FOO;
+getc STDIN;
+getc FH2;
+EXPECT
+getc() on unopened filehandle FOO at - line 3.
+getc() on closed filehandle STDIN at - line 5.
+getc() on closed filehandle FH2 at - line 12.
+########
+# pp_sys.c [pp_sselect]
+use warnings 'misc';
+$x = 1;
+select $x, undef, undef, 1;
+no warnings 'misc';
+select $x, undef, undef, 1;
+EXPECT
+Non-string passed as bitmask at - line 4.
+########
+use Config;
+BEGIN {
+    if (!$Config{d_fchdir}) {
+       print <<EOM;
+SKIPPED
+# fchdir not present
+EOM
+       exit;
+    }
+}
+opendir FOO, '.'; closedir FOO;
+open BAR, '.'; close BAR;
+opendir $dh, '.'; closedir $dh;
+open $fh, '.'; close $fh;
+chdir FOO;
+chdir BAR;
+chdir $dh;
+chdir $fh;
+use warnings qw(unopened closed) ;
+chdir FOO;
+chdir BAR;
+chdir $dh;
+chdir $fh;
+EXPECT
+chdir() on unopened filehandle FOO at - line 20.
+chdir() on closed filehandle BAR at - line 21.
+chdir() on unopened filehandle $dh at - line 22.
+chdir() on closed filehandle $fh at - line 23.