source: vendor/perl/5.8.8/lib/Pod/t/eol.t@ 3181

Last change on this file since 3181 was 3181, checked in by bird, 18 years ago

perl 5.8.8

File size: 2.0 KB
Line 
1#!./perl -w
2
3use Test::More tests => 3;
4
5open(POD, ">$$.pod") or die "$$.pod: $!";
6print POD <<__EOF__;
7=pod
8
9=head1 NAME
10
11crlf
12
13=head1 DESCRIPTION
14
15crlf crlf crlf crlf crlf crlf crlf crlf crlf crlf crlf crlf crlf crlf crlf
16crlf crlf crlf crlf crlf crlf crlf crlf crlf crlf crlf crlf crlf crlf crlf
17crlf crlf crlf crlf crlf crlf crlf crlf crlf crlf crlf crlf crlf crlf crlf
18crlf crlf crlf crlf crlf crlf crlf crlf crlf crlf crlf crlf crlf crlf crlf
19
20 crlf crlf crlf crlf
21 crlf crlf crlf crlf
22 crlf crlf crlf crlf
23
24crlf crlf crlf crlf crlf crlf crlf crlf crlf crlf crlf crlf crlf crlf crlf
25crlf crlf crlf crlf crlf crlf crlf crlf crlf crlf crlf crlf crlf crlf crlf
26crlf crlf crlf crlf crlf crlf crlf crlf crlf crlf crlf crlf crlf crlf crlf
27crlf crlf crlf crlf crlf crlf crlf crlf crlf crlf crlf crlf crlf crlf crlf
28
29=cut
30__EOF__
31close(POD);
32
33use Pod::Html;
34
35# --- CR ---
36
37open(POD, "<$$.pod") or die "$$.pod: $!";
38open(IN, ">$$.in") or die "$$.in: $!";
39while (<POD>) {
40 s/[\r\n]+/\r/g;
41 print IN $_;
42}
43close(POD);
44close(IN);
45
46pod2html("--title=eol", "--infile=$$.in", "--outfile=$$.o1");
47
48# --- LF ---
49
50open(POD, "<$$.pod") or die "$$.pod: $!";
51open(IN, ">$$.in") or die "$$.in: $!";
52while (<POD>) {
53 s/[\r\n]+/\n/g;
54 print IN $_;
55}
56close(POD);
57close(IN);
58
59pod2html("--title=eol", "--infile=$$.in", "--outfile=$$.o2");
60
61# --- CRLF ---
62
63open(POD, "<$$.pod") or die "$$.pod: $!";
64open(IN, ">$$.in") or die "$$.in: $!";
65while (<POD>) {
66 s/[\r\n]+/\r\n/g;
67 print IN $_;
68}
69close(POD);
70close(IN);
71
72pod2html("--title=eol", "--infile=$$.in", "--outfile=$$.o3");
73
74# --- now test ---
75
76local $/;
77
78open(IN, "<$$.o1") or die "$$.o1: $!";
79my $cksum1 = unpack("%32C*", <IN>);
80
81open(IN, "<$$.o2") or die "$$.o2: $!";
82my $cksum2 = unpack("%32C*", <IN>);
83
84open(IN, "<$$.o3") or die "$$.o3: $!";
85my $cksum3 = unpack("%32C*", <IN>);
86
87ok($cksum1 == $cksum2, "CR vs LF");
88ok($cksum1 == $cksum3, "CR vs CRLF");
89ok($cksum2 == $cksum3, "LF vs CRLF");
90close IN;
91
92END {
93 1 while unlink("$$.pod", "$$.in", "$$.o1", "$$.o2", "$$.o3",
94 "pod2htmd.x~~", "pod2htmi.x~~");
95}
Note: See TracBrowser for help on using the repository browser.