12 BEGIN { plan tests => 26 };
13 use Pod::Simple::TextContent;
14 use Pod::Simple::Text;
17 *mytime = defined(&Win32::GetTickCount)
18 ? sub () {Win32::GetTickCount() / 1000}
22 $Pod::Simple::Text::FREAKYMODE = 1;
23 use Pod::Simple::TiedOutFH ();
25 chdir 't' unless $ENV{PERL_CORE};
29 if ($ENV{PERL_CORE}) {
31 my $updir = File::Spec->updir;
32 my $dir = File::Spec->catdir ($updir, 'lib', 'Pod', 'Simple', 't');
33 return File::Spec->catfile ($dir, $file);
39 my $outfile = '10000';
49 unless(-e source_path($file)) {
51 print "# But $file doesn't exist!!\n";
56 my $precooked = source_path($file);
57 $precooked =~ s<\.pod><o.txt>s;
58 unless(-e $precooked) {
60 print "# But $precooked doesn't exist!!\n";
64 print "#\n#\n#\n###################\n# $file\n";
65 foreach my $class ('Pod::Simple::TextContent', 'Pod::Simple::Text') {
68 $p->output_string(\$out[-1]);
70 $p->parse_file(source_path($file));
71 printf "# %s %s %sb, %.03fs\n",
72 ref($p), source_path($file), length($out[-1]), mytime() - $t ;
76 print "# Reading $precooked...\n";
77 open(IN, $precooked) or die "Can't read-open $precooked: $!";
83 print "# ", length($out[-1]), " bytes pulled in.\n";
86 for (@out) { s/\s+/ /g; s/^\s+//s; s/\s+$//s; }
89 print "#\n#Now comparing 1 and 2...\n";
90 $faily += compare2($out[0], $out[1]);
91 print "#\n#Now comparing 2 and 3...\n";
92 $faily += compare2($out[1], $out[2]);
93 print "#\n#Now comparing 1 and 3...\n";
94 $faily += compare2($out[0], $out[2]);
99 my @outnames = map $outfile . $_ , qw(0 1);
100 open(OUT2, ">$outnames[0].~out.txt") || die "Can't write-open $outnames[0].txt: $!";
102 foreach my $out (@out) { push @outnames, $outnames[-1]; ++$outnames[-1] };
104 printf "# Writing to %s.txt .. %s.txt\n", $outnames[0], $outnames[-1];
108 foreach my $out (@out) {
109 my $outname = shift @outnames;
110 open(OUT, ">$outname.txt") || die "Can't write-open $outname.txt: $!";
112 print OUT $out, "\n";
113 print OUT2 $out, "\n";
120 print "# Wrapping up... one for the road...\n";
122 print "# --- Done with ", __FILE__, " --- \n";
128 if($out[0] eq $out[1]) {
132 for ($out[0], $out[1]) { tr/ //d; };
135 print "# Differ only in whitespace.\n";
139 #ok $out[0], $out[1];
141 my $x = $out[0] ^ $out[1];
142 $x =~ m/^(\x00*)/s or die;
144 print "# Difference at byte $at...\n";
149 print "# ", substr($out[0],$at,20), "\n";
150 print "# ", substr($out[1],$at,20), "\n";
157 printf "# Unequal lengths %s and %s\n", length($out[0]), length($out[1]);