summaryrefslogtreecommitdiff
path: root/t
diff options
context:
space:
mode:
authorGurusamy Sarathy <gsar@cpan.org>1999-07-07 06:41:13 +0000
committerGurusamy Sarathy <gsar@cpan.org>1999-07-07 06:41:13 +0000
commitaf8c498a3c5921fd79e24d6a33b8c04cc35f453b (patch)
treedd5f1e19ef871d47b9e9a1c89dc463de3ff19eb9 /t
parentb522bf068e1d0db0c7adc5726238584c2aaf623d (diff)
downloadperl-af8c498a3c5921fd79e24d6a33b8c04cc35f453b.tar.gz
better diagnostics on read operations from write-only
filehandles p4raw-id: //depot/perl@3632
Diffstat (limited to 't')
-rw-r--r--t/pragma/warn/pp_hot18
-rw-r--r--t/pragma/warn/pp_sys8
2 files changed, 20 insertions, 6 deletions
diff --git a/t/pragma/warn/pp_hot b/t/pragma/warn/pp_hot
index c78b2667e6..817c0c89d6 100644
--- a/t/pragma/warn/pp_hot
+++ b/t/pragma/warn/pp_hot
@@ -6,6 +6,8 @@
Filehandle %s opened only for input
print STDIN "abc" ;
+ Filehandle %s opened only for output
+ print <STDOUT> ;
print on closed filehandle %s
close STDIN ; print STDIN "abc" ;
@@ -22,7 +24,7 @@
Reference found where even-sized list expected
$X = [ 1 ..3 ];
- Read on closed filehandle <%s>
+ Read on closed filehandle %s
close STDIN ; $a = <STDIN>;
Deep recursion on subroutine \"%s\"
@@ -42,8 +44,20 @@ Filehandle main::abc never opened at - line 4.
# pp_hot.c
use warning 'io' ;
print STDIN "anc";
+print <STDOUT>;
+print <STDERR>;
+open(FOO, ">&STDOUT") and print <FOO>;
+print getc(STDERR);
+print getc(FOO);
+read(FOO,$_,1);
EXPECT
Filehandle main::STDIN opened only for input at - line 3.
+Filehandle main::STDOUT opened only for output at - line 4.
+Filehandle main::STDERR opened only for output at - line 5.
+Filehandle main::FOO opened only for output at - line 6.
+Filehandle main::STDERR opened only for output at - line 7.
+Filehandle main::FOO opened only for output at - line 8.
+Filehandle main::FOO opened only for output at - line 9.
########
# pp_hot.c
use warning 'closed' ;
@@ -82,7 +96,7 @@ Reference found where even-sized list expected at - line 3.
use warning 'closed' ;
close STDIN ; $a = <STDIN> ;
EXPECT
-Read on closed filehandle <STDIN> at - line 3.
+Read on closed filehandle main::STDIN at - line 3.
########
# pp_hot.c
use warning 'recursion' ;
diff --git a/t/pragma/warn/pp_sys b/t/pragma/warn/pp_sys
index 8f2c255bc3..82d1501147 100644
--- a/t/pragma/warn/pp_sys
+++ b/t/pragma/warn/pp_sys
@@ -3,12 +3,12 @@
untie attempted while %d inner references still exist
sub TIESCALAR { bless [] } ; tie $a, 'main'; untie $a ;
- Filehandle only opened for input
+ Filehandle %s opened only for input
format STDIN =
.
write STDIN;
- Write on closed filehandle
+ Write on closed filehandle %s
format STDIN =
.
close STDIN;
@@ -91,7 +91,7 @@ format STDIN =
.
write STDIN;
EXPECT
-Filehandle only opened for input at - line 5.
+Filehandle main::STDIN opened only for input at - line 5.
########
# pp_sys.c
use warning 'closed' ;
@@ -100,7 +100,7 @@ format STDIN =
close STDIN;
write STDIN;
EXPECT
-Write on closed filehandle at - line 6.
+Write on closed filehandle main::STDIN at - line 6.
########
# pp_sys.c
use warning 'io' ;