Integrate:
[p5sagit/p5-mst-13.2.git] / t / io / crlf.t
index 08ab4fe..084be21 100644 (file)
@@ -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,22 @@ if (find PerlIO::Layer 'perlio') {
  { local $/; $text = <FOO> }
  is(count_chars($text, "\015\012"), 2000);
 
+ SKIP:
+ {
+  eval 'use PerlIO::scalar';
+  skip(q/miniperl cannnot load PerlIO::scalar/)
+      if $@ =~ /dynamic loading not available/;
+  my $fcontents = join "", map {"$_\015\012"} "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 {