summaryrefslogtreecommitdiff
path: root/t/io/crlf.t
blob: 0968b3653d84f9934e1ad2c7a52cba9d945a9047 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
#!./perl -w

BEGIN {
    chdir 't' if -d 't';
    @INC = qw(. ../lib);
}

use Config;

require "test.pl";

my $file = "crlf$$.dat";
END {
 unlink($file);
}

if (find PerlIO::Layer 'perlio') {
 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;
 my $cr = "\r";
 while (<FOO>)
  {
   $seen += tr/[\015]//;
  }
 is($seen,0);
 binmode(FOO);
 seek(FOO,0,0);
 $seen = 0;
 while (<FOO>)
  {
   $seen += tr/[\015]//;
  }
 is($seen,2000);
 ok(close(FOO));
}
else {
 skip_all("No perlio, so no :crlf");
}