diff options
author | Nicholas Clark <nick@ccl4.org> | 2012-02-07 17:07:33 +0100 |
---|---|---|
committer | Nicholas Clark <nick@ccl4.org> | 2012-02-08 17:59:32 +0100 |
commit | 5356b890f5d45a262b5463bd396cad73f175e1b6 (patch) | |
tree | b84dfaa82f9b2b1116ecf714c65de4a69569b62f /ext | |
parent | 1a87ef38d274e06b5f822ca3e4e88b08e8f01c94 (diff) | |
download | perl-5356b890f5d45a262b5463bd396cad73f175e1b6.tar.gz |
Move lib/Pod/t/eol.t to ext/Pod-Html, as it's testing Pod::Html.
Diffstat (limited to 'ext')
-rw-r--r-- | ext/Pod-Html/t/eol.t | 71 |
1 files changed, 71 insertions, 0 deletions
diff --git a/ext/Pod-Html/t/eol.t b/ext/Pod-Html/t/eol.t new file mode 100644 index 0000000000..a159fb7551 --- /dev/null +++ b/ext/Pod-Html/t/eol.t @@ -0,0 +1,71 @@ +#!./perl -w + +use Test::More tests => 3; + +my $podfile = "$$.pod"; +my $infile = "$$.in"; +my @outfile = map { "$$.o$_" } 0..2; + +open my $pod, '>', $podfile or die "$podfile: $!"; +print $pod <<__EOF__; +=pod + +=head1 NAME + +crlf + +=head1 DESCRIPTION + +crlf crlf crlf crlf crlf crlf crlf crlf crlf crlf crlf crlf crlf crlf crlf +crlf crlf crlf crlf crlf crlf crlf crlf crlf crlf crlf crlf crlf crlf crlf +crlf crlf crlf crlf crlf crlf crlf crlf crlf crlf crlf crlf crlf crlf crlf +crlf crlf crlf crlf crlf crlf crlf crlf crlf crlf crlf crlf crlf crlf crlf + + crlf crlf crlf crlf + crlf crlf crlf crlf + crlf crlf crlf crlf + +crlf crlf crlf crlf crlf crlf crlf crlf crlf crlf crlf crlf crlf crlf crlf +crlf crlf crlf crlf crlf crlf crlf crlf crlf crlf crlf crlf crlf crlf crlf +crlf crlf crlf crlf crlf crlf crlf crlf crlf crlf crlf crlf crlf crlf crlf +crlf crlf crlf crlf crlf crlf crlf crlf crlf crlf crlf crlf crlf crlf crlf + +=cut +__EOF__ +close $pod or die $!; + +use Pod::Html; + +my $i = 0; +foreach my $eol ("\r", "\n", "\r\n") { + open $pod, '<', $podfile or die "$podfile: $!"; + open my $in, '>', $infile or die "$infile: $!"; + while (<$pod>) { + s/[\r\n]+/$eol/g; + print $in $_; + } + close $pod or die $!; + close $in or die $!; + + pod2html("--title=eol", "--infile=$infile", "--outfile=$outfile[$i]"); + ++$i; +} + +# --- now test --- + +my @cksum; + +foreach (0..2) { + local $/; + open my $in, '<', $outfile[$_] or die "$outfile[$_]: $!"; + $cksum[$_] = unpack "%32C*", <$in>; + close $in or die $!; +} + +is($cksum[0], $cksum[1], "CR vs LF"); +is($cksum[0], $cksum[2], "CR vs CRLF"); +is($cksum[1], $cksum[2], "LF vs CRLF"); + +END { + 1 while unlink $podfile, $infile, @outfile, 'pod2htmd.tmp'; +} |