summaryrefslogtreecommitdiff
path: root/t/pragma/warn
diff options
context:
space:
mode:
authorGurusamy Sarathy <gsar@cpan.org>2000-01-21 04:28:08 +0000
committerGurusamy Sarathy <gsar@cpan.org>2000-01-21 04:28:08 +0000
commit69282e910994b718c7eedc8f550888058a4e93ff (patch)
tree7b03bc1b24a50d77983c616709e61e9238cee94a /t/pragma/warn
parent2decb4fb82e001e3c9671c57b61232c651a9c22c (diff)
downloadperl-69282e910994b718c7eedc8f550888058a4e93ff.tar.gz
patch to report warnings on bogus filehandles passed to flock(),
more consistent warnings, from Greg Bacon <gbacon@itsc.uah.edu> (slightly modified) p4raw-id: //depot/perl@4830
Diffstat (limited to 't/pragma/warn')
-rw-r--r--t/pragma/warn/pp_hot14
-rw-r--r--t/pragma/warn/pp_sys131
2 files changed, 120 insertions, 25 deletions
diff --git a/t/pragma/warn/pp_hot b/t/pragma/warn/pp_hot
index 7e19dc5c94..312f7da9b2 100644
--- a/t/pragma/warn/pp_hot
+++ b/t/pragma/warn/pp_hot
@@ -83,10 +83,17 @@ Filehandle main::FOO opened only for output at - line 8.
use warnings 'closed' ;
close STDIN ;
print STDIN "anc";
+opendir STDIN, ".";
+print STDIN "anc";
+closedir STDIN;
no warnings 'closed' ;
print STDIN "anc";
+opendir STDIN, ".";
+print STDIN "anc";
EXPECT
print() on closed filehandle main::STDIN at - line 4.
+print() on closed filehandle main::STDIN at - line 6.
+(Are you trying to call print() on dirhandle main::STDIN?)
########
# pp_hot.c [pp_rv2av]
use warnings 'uninitialized' ;
@@ -124,11 +131,16 @@ Reference found where even-sized list expected at - line 3.
########
# pp_hot.c [Perl_do_readline]
use warnings 'closed' ;
-close STDIN ; $a = <STDIN> ;
+close STDIN ; $a = <STDIN> ;
+opendir STDIN, "." ; $a = <STDIN> ;
+closedir STDIN;
no warnings 'closed' ;
+opendir STDIN, "." ; $a = <STDIN> ;
$a = <STDIN> ;
EXPECT
readline() on closed filehandle main::STDIN at - line 3.
+readline() on closed filehandle main::STDIN at - line 4.
+(Are you trying to call readline() on dirhandle main::STDIN?)
########
# pp_hot.c [Perl_do_readline]
use warnings 'io' ;
diff --git a/t/pragma/warn/pp_sys b/t/pragma/warn/pp_sys
index ea4b536842..5808536752 100644
--- a/t/pragma/warn/pp_sys
+++ b/t/pragma/warn/pp_sys
@@ -27,47 +27,51 @@
close STDIN ;
printf STDIN "fred"
- syswrite() on closed filehandle [pp_send]
+ syswrite() on closed filehandle %s [pp_send]
close STDIN;
syswrite STDIN, "fred", 1;
- send() on closed socket [pp_send]
+ send() on closed socket %s [pp_send]
close STDIN;
send STDIN, "fred", 1
- bind() on closed socket [pp_bind]
+ bind() on closed socket %s [pp_bind]
close STDIN;
bind STDIN, "fred" ;
- connect() on closed socket [pp_connect]
+ connect() on closed socket %s [pp_connect]
close STDIN;
connect STDIN, "fred" ;
- listen() on closed socket [pp_listen]
+ listen() on closed socket %s [pp_listen]
close STDIN;
listen STDIN, 2;
- accept() on closed socket [pp_accept]
+ accept() on closed socket %s [pp_accept]
close STDIN;
- accept STDIN, "fred" ;
+ accept "fred", STDIN ;
- shutdown() on closed socket [pp_shutdown]
+ shutdown() on closed socket %s [pp_shutdown]
close STDIN;
shutdown STDIN, 0;
- setsockopt() on closed socket [pp_ssockopt]
- getsockopt() on closed socket [pp_ssockopt]
+ setsockopt() on closed socket %s [pp_ssockopt]
+ getsockopt() on closed socket %s [pp_ssockopt]
close STDIN;
setsockopt STDIN, 1,2,3;
getsockopt STDIN, 1,2;
- getsockname() on closed socket [pp_getpeername]
- getpeername() on closed socket [pp_getpeername]
+ getsockname() on closed socket %s [pp_getpeername]
+ getpeername() on closed socket %s [pp_getpeername]
close STDIN;
getsockname STDIN;
getpeername STDIN;
+ flock() on closed socket %s [pp_flock]
+ close STDIN;
+ flock STDIN, 8;
+
warn(warn_nl, "stat"); [pp_stat]
Test on unopened file <%s>
@@ -111,10 +115,17 @@ format STDIN =
.
close STDIN;
write STDIN;
+opendir STDIN, ".";
+write STDIN;
+closedir STDIN;
no warnings 'closed' ;
write STDIN;
+opendir STDIN, ".";
+write STDIN;
EXPECT
write() on closed filehandle main::STDIN at - line 6.
+write() on closed filehandle main::STDIN at - line 8.
+(Are you trying to call write() on dirhandle main::STDIN?)
########
# pp_sys.c [pp_leavewrite]
use warnings 'io' ;
@@ -147,10 +158,17 @@ Filehandle main::abc never opened at - line 4.
use warnings 'closed' ;
close STDIN ;
printf STDIN "fred";
+opendir STDIN, ".";
+printf STDIN "fred";
+closedir STDIN;
no warnings 'closed' ;
printf STDIN "fred";
+opendir STDIN, ".";
+printf STDIN "fred";
EXPECT
printf() on closed filehandle main::STDIN at - line 4.
+printf() on closed filehandle main::STDIN at - line 6.
+(Are you trying to call printf() on dirhandle main::STDIN?)
########
# pp_sys.c [pp_prtf]
use warnings 'io' ;
@@ -164,10 +182,32 @@ Filehandle main::STDIN opened only for input at - line 3.
use warnings 'closed' ;
close STDIN;
syswrite STDIN, "fred", 1;
+opendir STDIN, ".";
+syswrite STDIN, "fred", 1;
+closedir STDIN;
no warnings 'closed' ;
syswrite STDIN, "fred", 1;
+opendir STDIN, ".";
+syswrite STDIN, "fred", 1;
EXPECT
-syswrite() on closed filehandle at - line 4.
+syswrite() on closed filehandle main::STDIN at - line 4.
+syswrite() on closed filehandle main::STDIN at - line 6.
+(Are you trying to call syswrite() on dirhandle main::STDIN?)
+########
+# pp_sys.c [pp_flock]
+use warnings 'closed' ;
+close STDIN;
+flock STDIN, 8;
+opendir STDIN, ".";
+flock STDIN, 8;
+no warnings 'closed' ;
+flock STDIN, 8;
+opendir STDIN, ".";
+flock STDIN, 8;
+EXPECT
+flock() on closed filehandle main::STDIN at - line 4.
+flock() on closed filehandle main::STDIN at - line 6.
+(Are you trying to call flock() on dirhandle main::STDIN?)
########
# pp_sys.c [pp_prtf pp_send pp_bind pp_connect pp_listen pp_accept pp_shutdown pp_ssockopt ppp_getpeername]
use warnings 'io' ;
@@ -194,12 +234,24 @@ send STDIN, "fred", 1;
bind STDIN, "fred" ;
connect STDIN, "fred" ;
listen STDIN, 2;
-accept STDIN, "fred" ;
+accept "fred", STDIN;
+shutdown STDIN, 0;
+setsockopt STDIN, 1,2,3;
+getsockopt STDIN, 1,2;
+getsockname STDIN;
+getpeername STDIN;
+opendir STDIN, ".";
+send STDIN, "fred", 1;
+bind STDIN, "fred" ;
+connect STDIN, "fred" ;
+listen STDIN, 2;
+accept "fred", STDIN;
shutdown STDIN, 0;
setsockopt STDIN, 1,2,3;
getsockopt STDIN, 1,2;
getsockname STDIN;
getpeername STDIN;
+closedir STDIN;
no warnings 'io' ;
send STDIN, "fred", 1;
bind STDIN, "fred" ;
@@ -211,17 +263,48 @@ setsockopt STDIN, 1,2,3;
getsockopt STDIN, 1,2;
getsockname STDIN;
getpeername STDIN;
+opendir STDIN, ".";
+send STDIN, "fred", 1;
+bind STDIN, "fred" ;
+connect STDIN, "fred" ;
+listen STDIN, 2;
+accept "fred", STDIN;
+shutdown STDIN, 0;
+setsockopt STDIN, 1,2,3;
+getsockopt STDIN, 1,2;
+getsockname STDIN;
+getpeername STDIN;
EXPECT
-send() on closed socket at - line 22.
-bind() on closed socket at - line 23.
-connect() on closed socket at - line 24.
-listen() on closed socket at - line 25.
-accept() on closed socket at - line 26.
-shutdown() on closed socket at - line 27.
-setsockopt() on closed socket at - line 28.
-getsockopt() on closed socket at - line 29.
-getsockname() on closed socket at - line 30.
-getpeername() on closed socket at - line 31.
+send() on closed socket main::STDIN at - line 22.
+bind() on closed socket main::STDIN at - line 23.
+connect() on closed socket main::STDIN at - line 24.
+listen() on closed socket main::STDIN at - line 25.
+accept() on closed socket main::STDIN at - line 26.
+shutdown() on closed socket main::STDIN at - line 27.
+setsockopt() on closed socket main::STDIN at - line 28.
+getsockopt() on closed socket main::STDIN at - line 29.
+getsockname() on closed socket main::STDIN at - line 30.
+getpeername() on closed socket main::STDIN at - line 31.
+send() on closed socket main::STDIN at - line 33.
+(Are you trying to call send() on dirhandle main::STDIN?)
+bind() on closed socket main::STDIN at - line 34.
+(Are you trying to call bind() on dirhandle main::STDIN?)
+connect() on closed socket main::STDIN at - line 35.
+(Are you trying to call connect() on dirhandle main::STDIN?)
+listen() on closed socket main::STDIN at - line 36.
+(Are you trying to call listen() on dirhandle main::STDIN?)
+accept() on closed socket main::STDIN at - line 37.
+(Are you trying to call accept() on dirhandle main::STDIN?)
+shutdown() on closed socket main::STDIN at - line 38.
+(Are you trying to call shutdown() on dirhandle main::STDIN?)
+setsockopt() on closed socket main::STDIN at - line 39.
+(Are you trying to call setsockopt() on dirhandle main::STDIN?)
+getsockopt() on closed socket main::STDIN at - line 40.
+(Are you trying to call getsockopt() on dirhandle main::STDIN?)
+getsockname() on closed socket main::STDIN at - line 41.
+(Are you trying to call getsockname() on dirhandle main::STDIN?)
+getpeername() on closed socket main::STDIN at - line 42.
+(Are you trying to call getpeername() on dirhandle main::STDIN?)
########
# pp_sys.c [pp_stat]
use warnings 'newline' ;