This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
[perl #121112] only warn if newline is the last non-NUL character
[perl5.git] / t / lib / warnings / pp_sys
index 3df894c..a4f4aba 100644 (file)
@@ -154,7 +154,6 @@ write() on closed filehandle STDIN at - line 8.
 write() on closed filehandle STDIN at - line 11.
        (Are you trying to call write() on dirhandle STDIN?)
 ########
-########
 # pp_sys.c [pp_leavewrite]
 use warnings 'unopened';
 format STDIN =
@@ -178,8 +177,8 @@ opendir FOO, ".";
 write STDIN;
 write FOO;
 EXPECT
-write() on unopened filehandle FOO at - line 10.
-write() on unopened filehandle FOO at - line 15.
+write() on unopened filehandle FOO at - line 9.
+write() on unopened filehandle FOO at - line 14.
        (Are you trying to call write() on dirhandle FOO?)
 ########
 # pp_sys.c [pp_leavewrite]
@@ -573,10 +572,15 @@ getpeername() on unopened socket FOO at - line 64.
 # pp_sys.c [pp_stat]
 use warnings 'newline' ;
 stat "abc\ndef";
+stat "abcdef\n";
+stat "abcdef\n\0";
 no warnings 'newline' ;
 stat "abc\ndef";
+stat "abcdef\n";
+stat "abcdef\n\0";
 EXPECT
-Unsuccessful stat on filename containing newline at - line 3.
+Unsuccessful stat on filename containing newline at - line 4.
+Unsuccessful stat on filename containing newline at - line 5.
 ########
 # pp_sys.c [pp_fttext]
 use warnings qw(unopened closed) ;
@@ -585,24 +589,34 @@ close STDIN ;
 stat(STDIN) ;
 -T HOCUS;
 stat(POCUS);
+stat "../test.pl";
+stat *foo;
 no warnings qw(unopened closed) ;
 -T STDIN ;
 stat(STDIN);
 -T HOCUS;
 stat(POCUS);
+stat "../test.pl";
+stat *foo;
 EXPECT
 -T on closed filehandle STDIN at - line 4.
 stat() on closed filehandle STDIN at - line 5.
 -T on unopened filehandle HOCUS at - line 6.
 stat() on unopened filehandle POCUS at - line 7.
+stat() on unopened filehandle foo at - line 9.
 ########
 # pp_sys.c [pp_fttext]
 use warnings 'newline' ;
 -T "abc\ndef" ;
+-T "abcdef\n" ;
+-T "abcdef\n\0" ;
 no warnings 'newline' ;
 -T "abc\ndef" ;
+-T "abcdef\n" ;
+-T "abcdef\n\0" ;
 EXPECT
-Unsuccessful open on filename containing newline at - line 3.
+Unsuccessful open on filename containing newline at - line 4.
+Unsuccessful open on filename containing newline at - line 5.
 ########
 # pp_sys.c [pp_sysread]
 use warnings 'io' ;
@@ -648,6 +662,7 @@ lstat *FH;
 lstat \*FH;
 open my $fh, $0 or die "# $!";
 lstat $fh;
+lstat *FH{IO};
 no warnings 'io';
 lstat FH;
 lstat $fh;
@@ -658,6 +673,7 @@ lstat() on filehandle FH at - line 4.
 lstat() on filehandle FH at - line 5.
 lstat() on filehandle FH at - line 6.
 lstat() on filehandle $fh at - line 8.
+lstat() on filehandle at - line 9.
 ########
 
 # pp_sys.c [pp_lstat]
@@ -800,6 +816,17 @@ Opening filehandle FOO also as a directory at - line 9.
 Opening filehandle $foo also as a directory at - line 10.
 ########
 # pp_sys.c [pp_*dir]
+use Config ;
+BEGIN {
+    if ( ! $Config{d_telldir}) {
+        print <<EOM ;
+SKIPPED
+# telldir not present
+EOM
+        exit
+    }
+}
+#line 2
 use warnings 'io';
 opendir FOO, ".";
 opendir $foo, ".";
@@ -832,6 +859,17 @@ closedir() attempted on invalid dirhandle $foo at - line 18.
 ########
 
 # pp_sys.c [pp_*dir]
+use Config ;
+BEGIN {
+    if ( ! $Config{d_telldir}) {
+        print <<EOM ;
+SKIPPED
+# telldir not present
+EOM
+        exit
+    }
+}
+#line 3
 use utf8;
 use open qw( :utf8 :std );
 use warnings 'io';