4
BEGIN { plan tests => 26 };
5
use Pod::Simple::TextContent;
9
*mytime = defined(&Win32::GetTickCount)
10
? sub () {Win32::GetTickCount() / 1000}
14
$Pod::Simple::Text::FREAKYMODE = 1;
15
use Pod::Simple::TiedOutFH ();
17
my $outfile = '10000';
19
chdir "t" or die "Can't chdir: $!" if -e "t";
25
"test_old_perlcygwin.pod",
26
"test_old_perlfaq3.pod",
27
"test_old_perlvar.pod",
32
print "# But $file doesn't exist!!\n";
37
my $precooked = $file;
38
$precooked =~ s<\.pod><_out.txt>s;
39
unless(-e $precooked) {
41
print "# But $precooked doesn't exist!!\n";
45
print "#\n#\n#\n###################\n# $file\n";
46
foreach my $class ('Pod::Simple::TextContent', 'Pod::Simple::Text') {
49
$p->output_string(\$out[-1]);
51
$p->parse_file($file);
52
printf "# %s %s %sb, %.03fs\n",
53
ref($p), $file, length($out[-1]), mytime() - $t ;
57
print "# Reading $precooked...\n";
58
open(IN, $precooked) or die "Can't read-open $precooked: $!";
64
print "# ", length($out[-1]), " bytes pulled in.\n";
67
for (@out) { s/\s+/ /g; s/^\s+//s; s/\s+$//s; }
70
print "#\n#Now comparing 1 and 2...\n";
71
$faily += compare2($out[0], $out[1]);
72
print "#\n#Now comparing 2 and 3...\n";
73
$faily += compare2($out[1], $out[2]);
74
print "#\n#Now comparing 1 and 3...\n";
75
$faily += compare2($out[0], $out[2]);
80
my @outnames = map $outfile . $_ , qw(0 1);
81
open(OUT2, ">$outnames[0].~out.txt") || die "Can't write-open $outnames[0].txt: $!";
83
foreach my $out (@out) { push @outnames, $outnames[-1]; ++$outnames[-1] };
85
printf "# Writing to %s.txt .. %s.txt\n", $outnames[0], $outnames[-1];
89
foreach my $out (@out) {
90
my $outname = shift @outnames;
91
open(OUT, ">$outname.txt") || die "Can't write-open $outname.txt: $!";
94
print OUT2 $out, "\n";
101
print "# Wrapping up... one for the road...\n";
103
print "# --- Done with ", __FILE__, " --- \n";
109
if($out[0] eq $out[1]) {
113
for ($out[0], $out[1]) { tr/ //d; };
116
print "# Differ only in whitespace.\n";
120
#ok $out[0], $out[1];
122
my $x = $out[0] ^ $out[1];
123
$x =~ m/^(\x00*)/s or die;
125
print "# Difference at byte $at...\n";
130
print "# ", substr($out[0],$at,20), "\n";
131
print "# ", substr($out[1],$at,20), "\n";
138
printf "# Unequal lengths %s and %s\n", length($out[0]), length($out[1]);