diff options
author | Nick Ing-Simmons <nik@tiuk.ti.com> | 2002-08-11 10:25:15 +0000 |
---|---|---|
committer | Nick Ing-Simmons <nik@tiuk.ti.com> | 2002-08-11 10:25:15 +0000 |
commit | e949e37c57a7b8894b837a34a436233508daf2e1 (patch) | |
tree | 66357da41da47fff5b42e22bcd65c5e22744a66d /t/io/crlf.t | |
parent | ed423f7afb5038546a92d00ca689992f3e08bc61 (diff) | |
download | perl-e949e37c57a7b8894b837a34a436233508daf2e1.tar.gz |
Fix for [perl #15986] tell/seek misbehave for :crlf
Test from "Vadim Konovalov" <vkonovalov@peterstar.ru>
fix by Nick I-S based on study of problem based
on Vadim's analysis.
p4raw-id: //depot/perlio@17709
Diffstat (limited to 't/io/crlf.t')
-rw-r--r-- | t/io/crlf.t | 14 |
1 files changed, 13 insertions, 1 deletions
diff --git a/t/io/crlf.t b/t/io/crlf.t index 08ab4fe3b0..484596bd47 100644 --- a/t/io/crlf.t +++ b/t/io/crlf.t @@ -15,7 +15,7 @@ END { } if (find PerlIO::Layer 'perlio') { - plan(tests => 7); + plan(tests => 8); ok(open(FOO,">:crlf",$file)); ok(print FOO 'a'.((('a' x 14).qq{\n}) x 2000) || close(FOO)); ok(open(FOO,"<:crlf",$file)); @@ -30,6 +30,18 @@ if (find PerlIO::Layer 'perlio') { { local $/; $text = <FOO> } is(count_chars($text, "\015\012"), 2000); + { + my $fcontents = join "", map {"$_\r\n"} "a".."zzz"; + open my $fh, "<:crlf", \$fcontents; + local $/ = "xxx"; + local $_ = <$fh>; + my $pos = tell $fh; # pos must be behind "xxx", before "\nyyy\n" + seek $fh, $pos, 0; + $/ = "\n"; + $s = <$fh>.<$fh>; + ok($s eq "\nxxy\n"); + } + ok(close(FOO)); } else { |