Skip to content

Commit 3732e2e

Browse files
tonycozkylinos-aq-xinjiahao
authored and
kylinos-aq-xinjiahao
committed
test that <> doesn't clear the stream error state
Bug-Debian: https://bugs.debian.org/1016369 Bug: Perl/perl5#6799 Origin: backport, Perl/perl5@0b60216 Gbp-Pq: Topic fixes Gbp-Pq: Name readline-stream-errors-test.diff
1 parent 8f5b286 commit 3732e2e

File tree

1 file changed

+13
-1
lines changed

1 file changed

+13
-1
lines changed

t/op/readline.t

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ BEGIN {
66
set_up_inc('../lib');
77
}
88

9-
plan tests => 32;
9+
plan tests => 36;
1010

1111
# [perl #19566]: sv_gets writes directly to its argument via
1212
# TARG. Test that we respect SvREADONLY.
@@ -289,6 +289,18 @@ is ${^LAST_FH}, undef, '${^LAST_FH} after readline undef';
289289
'[perl #123790] *x=<y> used to fail an assertion';
290290
}
291291

292+
SKIP:
293+
{
294+
skip_without_dynamic_extension("IO", 4);
295+
my $tmpfile = tempfile();
296+
open my $fh, ">", $tmpfile
297+
or die "Cannot open $tmpfile: $!";
298+
ok(!$fh->error, "no error before we try to read");
299+
ok(!<$fh>, "fail to readline file opened for write");
300+
ok($fh->error, "error after trying to readline file opened for write");
301+
ok(!close($fh), "closing the file should fail");
302+
}
303+
292304
__DATA__
293305
moo
294306
moo

0 commit comments

Comments
 (0)