summaryrefslogtreecommitdiff
path: root/t
diff options
context:
space:
mode:
authorNicholas Clark <nick@ccl4.org>2010-12-30 16:52:22 +0000
committerNicholas Clark <nick@ccl4.org>2010-12-30 16:52:22 +0000
commitc521cf7c8af1697e5efd8ce3ad75ed00606db13b (patch)
tree218f51bab9cef4c2f05cc4468a8078df6a0e54c0 /t
parent8985fe98dcc5c0af2fadeac15dfbc13f553ee7fc (diff)
downloadperl-c521cf7c8af1697e5efd8ce3ad75ed00606db13b.tar.gz
pp_leavewrite wasn't warning for unopened handles unless 'closed' was enabled.
It was checking that category 'closed' was enabled for warnings before calling report_evil_fh(), which in turn was (correctly) checking category 'unopened'.
Diffstat (limited to 't')
-rw-r--r--t/lib/warnings/pp_sys39
1 files changed, 38 insertions, 1 deletions
diff --git a/t/lib/warnings/pp_sys b/t/lib/warnings/pp_sys
index 8c61397d6f..62e47c160f 100644
--- a/t/lib/warnings/pp_sys
+++ b/t/lib/warnings/pp_sys
@@ -131,20 +131,57 @@ Filehandle STDIN opened only for input at - line 5.
use warnings 'closed' ;
format STDIN =
.
+format FOO =
+.
close STDIN;
write STDIN;
+write FOO;
opendir STDIN, ".";
write STDIN;
closedir STDIN;
+opendir FOO, ".";
+write FOO;
+closedir FOO;
no warnings 'closed' ;
write STDIN;
+write FOO;
opendir STDIN, ".";
+opendir FOO, ".";
write STDIN;
+write FOO;
EXPECT
-write() on closed filehandle STDIN at - line 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 =
+.
+format FOO =
+.
+close STDIN;
+write STDIN;
+write FOO;
+opendir STDIN, ".";
+write STDIN;
+closedir STDIN;
+opendir FOO, ".";
+write FOO;
+closedir FOO;
+no warnings 'unopened';
+write STDIN;
+write FOO;
+opendir STDIN, ".";
+opendir FOO, ".";
+write STDIN;
+write FOO;
+EXPECT
+write() on unopened filehandle FOO at - line 10.
+write() on unopened filehandle FOO at - line 15.
+ (Are you trying to call write() on dirhandle FOO?)
+########
# pp_sys.c [pp_leavewrite]
use warnings 'io' ;
format STDOUT_TOP =