Turn the "$# / $* is no longer supported" warnings into
[p5sagit/p5-mst-13.2.git] / t / lib / warnings / pp_sys
index 8dc0bf9..2e9c613 100644 (file)
 
   getc() on closed filehandle                  [pp_getc]
 
+  Non-string passed as bitmask                 [pp_sselect]
+
 __END__
 # pp_sys.c [pp_untie]
 use warnings 'untie' ;
@@ -195,6 +197,14 @@ EXPECT
 Filehandle STDIN opened only for input at - line 3.
 ########
 # pp_sys.c [pp_send]
+use warnings 'io' ;
+syswrite STDIN, "fred";
+no warnings 'io' ;
+syswrite STDIN, "fred";
+EXPECT
+Filehandle STDIN opened only for input at - line 3.
+########
+# pp_sys.c [pp_send]
 use warnings 'closed' ;
 close STDIN; 
 syswrite STDIN, "fred", 1;
@@ -389,9 +399,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' ;
@@ -403,16 +422,18 @@ binmode() on unopened filehandle at - line 4.
 ########
 # pp_sys.c [pp_lstat]
 use warnings 'io';
-lstat STDIN;
+open FH, "harness" or die "# $!";
+lstat FH;
 open my $fh, $0 or die "# $!";
 lstat $fh;
 no warnings 'io';
-lstat STDIN;
+lstat FH;
 lstat $fh;
+close FH;
 close $fh;
 EXPECT
-lstat() on filehandle STDIN at - line 3.
-lstat() on filehandle $fh at - line 5.
+lstat() on filehandle FH at - line 4.
+lstat() on filehandle $fh at - line 6.
 ########
 # pp_sys.c [pp_getc]
 use warnings qw(unopened closed) ;
@@ -435,3 +456,67 @@ 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.
+########
+# pp_sys.c [pp_open]
+use warnings;
+opendir FOO, ".";
+opendir my $foo, ".";
+open FOO, "TEST";
+open $foo, "TEST";
+no warnings qw(io deprecated);
+open FOO, "TEST";
+open $foo, "TEST";
+EXPECT
+Opening dirhandle FOO also as a file at - line 5.
+Opening dirhandle $foo also as a file at - line 6.
+########
+# pp_sys.c [pp_open_dir]
+use warnings;
+open FOO, "TEST";
+open my $foo, "TEST";
+opendir FOO, ".";
+opendir $foo, ".";
+no warnings qw(io deprecated);
+opendir FOO, ".";
+opendir $foo, ".";
+EXPECT
+Opening filehandle FOO also as a directory at - line 5.
+Opening filehandle $foo also as a directory at - line 6.