Testcase for crlf spanning buffer boundary
Nick Ing-Simmons [Tue, 26 Mar 2002 15:31:55 +0000 (15:31 +0000)]
p4raw-id: //depot/perlio@15521

MANIFEST
t/io/crlf.t [new file with mode: 0644]

index 45d613d..4834bc5 100644 (file)
--- a/MANIFEST
+++ b/MANIFEST
@@ -2158,6 +2158,7 @@ t/comp/use.t                      See if pragmas work
 t/harness                      Finer diagnostics from test suite
 t/io/argv.t                    See if ARGV stuff works
 t/io/binmode.t                  See if binmode() works
+t/io/crlf.t                    See if :crlf works
 t/io/dup.t                     See if >& works right
 t/io/fflush.t                  See if auto-flush on fork/exec/system/qx works
 t/io/fs.t                      See if directory manipulations work
diff --git a/t/io/crlf.t b/t/io/crlf.t
new file mode 100644 (file)
index 0000000..858df17
--- /dev/null
@@ -0,0 +1,42 @@
+#!./perl -w
+
+BEGIN {
+    chdir 't' if -d 't';
+    @INC = qw(. ../lib);
+}
+
+use Config;
+
+require "test.pl";
+
+my $file = "crlf$$.dat";
+END {
+ unlink($file);
+}
+
+if ($Config{useperlio}) {
+ plan(tests => 6);
+ ok(open(FOO,">:crlf",$file));
+ ok(print FOO 'a'.((('a' x 14).qq{\n}) x 2000) || close(FOO));
+ ok(open(FOO,"<:crlf",$file));
+ my $seen = 0;
+ while (<FOO>)
+  {
+   $seen++ if (/\r/);
+  }
+ is($seen,0);
+ binmode(FOO);
+ seek(FOO,0,0);
+ $seen = 0;
+ while (<FOO>)
+  {
+   $seen++ if (/\r/);
+  }
+ is($seen,2000);
+ ok(close(FOO));
+}
+else {
+ skip_all("No perlio, so no :crlf");
+}
+
+