10 BEGIN { plan tests => 26 };
11 use Pod::Simple::TextContent;
12 use Pod::Simple::Text;
15 *mytime = defined(&Win32::GetTickCount)
16 ? sub () {Win32::GetTickCount() / 1000}
20 $Pod::Simple::Text::FREAKYMODE = 1;
21 use Pod::Simple::TiedOutFH ();
25 if ($ENV{PERL_CORE}) {
27 my $updir = File::Spec->updir;
28 my $dir = File::Spec->catdir ($updir, 'lib', 'Pod', 'Simple', 't');
29 return File::Spec->catfile ($dir, $file);
35 my $outfile = '10000';
45 unless(-e source_path($file)) {
47 print "# But $file doesn't exist!!\n";
52 my $precooked = source_path($file);
53 $precooked =~ s<\.pod><_out.txt>s;
54 unless(-e $precooked) {
56 print "# But $precooked doesn't exist!!\n";
60 print "#\n#\n#\n###################\n# $file\n";
61 foreach my $class ('Pod::Simple::TextContent', 'Pod::Simple::Text') {
64 $p->output_string(\$out[-1]);
66 $p->parse_file(source_path($file));
67 printf "# %s %s %sb, %.03fs\n",
68 ref($p), source_path($file), length($out[-1]), mytime() - $t ;
72 print "# Reading $precooked...\n";
73 open(IN, $precooked) or die "Can't read-open $precooked: $!";
79 print "# ", length($out[-1]), " bytes pulled in.\n";
82 for (@out) { s/\s+/ /g; s/^\s+//s; s/\s+$//s; }
85 print "#\n#Now comparing 1 and 2...\n";
86 $faily += compare2($out[0], $out[1]);
87 print "#\n#Now comparing 2 and 3...\n";
88 $faily += compare2($out[1], $out[2]);
89 print "#\n#Now comparing 1 and 3...\n";
90 $faily += compare2($out[0], $out[2]);
95 my @outnames = map $outfile . $_ , qw(0 1);
96 open(OUT2, ">$outnames[0].~out.txt") || die "Can't write-open $outnames[0].txt: $!";
98 foreach my $out (@out) { push @outnames, $outnames[-1]; ++$outnames[-1] };
100 printf "# Writing to %s.txt .. %s.txt\n", $outnames[0], $outnames[-1];
104 foreach my $out (@out) {
105 my $outname = shift @outnames;
106 open(OUT, ">$outname.txt") || die "Can't write-open $outname.txt: $!";
108 print OUT $out, "\n";
109 print OUT2 $out, "\n";
116 print "# Wrapping up... one for the road...\n";
118 print "# --- Done with ", __FILE__, " --- \n";
124 if($out[0] eq $out[1]) {
128 for ($out[0], $out[1]) { tr/ //d; };
131 print "# Differ only in whitespace.\n";
135 #ok $out[0], $out[1];
137 my $x = $out[0] ^ $out[1];
138 $x =~ m/^(\x00*)/s or die;
140 print "# Difference at byte $at...\n";
145 print "# ", substr($out[0],$at,20), "\n";
146 print "# ", substr($out[1],$at,20), "\n";
153 printf "# Unequal lengths %s and %s\n", length($out[0]), length($out[1]);