summaryrefslogtreecommitdiff
path: root/lib/Pod
diff options
context:
space:
mode:
authorRafael Garcia-Suarez <rgarciasuarez@gmail.com>2003-05-20 19:22:30 +0000
committerRafael Garcia-Suarez <rgarciasuarez@gmail.com>2003-05-20 19:22:30 +0000
commit66f3f260095e79305afd2e6927af42eda76ba830 (patch)
treed84a080dce63d03869a49119db5dc7f2154079df /lib/Pod
parent79d0183a28e4148ae5bcfffe06fd994f9a674c12 (diff)
downloadperl-66f3f260095e79305afd2e6927af42eda76ba830.tar.gz
Enhance the failure reporting for the pod2html tests
p4raw-id: //depot/perl@19575
Diffstat (limited to 'lib/Pod')
-rw-r--r--lib/Pod/t/htmlview.t2
-rw-r--r--lib/Pod/t/pod2html-lib.pl42
2 files changed, 30 insertions, 14 deletions
diff --git a/lib/Pod/t/htmlview.t b/lib/Pod/t/htmlview.t
index 9d82a87709..739d3003fb 100644
--- a/lib/Pod/t/htmlview.t
+++ b/lib/Pod/t/htmlview.t
@@ -7,13 +7,11 @@ BEGIN {
require "pod2html-lib.pl";
}
-
use strict;
use Test::More tests => 1;
convert_n_test("htmlview", "html rendering");
-
__DATA__
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
diff --git a/lib/Pod/t/pod2html-lib.pl b/lib/Pod/t/pod2html-lib.pl
index 3f1b267ee1..f61392b0db 100644
--- a/lib/Pod/t/pod2html-lib.pl
+++ b/lib/Pod/t/pod2html-lib.pl
@@ -21,22 +21,40 @@ sub convert_n_test {
);
- local $/;
- # expected
- my $expect = <DATA>;
- $expect =~ s/\[PERLADMIN\]/$Config::Config{perladmin}/;
- if (ord("A") == 193) { # EBCDIC.
- $expect =~ s/item_mat%3c%21%3e/item_mat%4c%5a%6e/;
+ my ($expect, $result);
+ {
+ local $/;
+ # expected
+ $expect = <DATA>;
+ $expect =~ s/\[PERLADMIN\]/$Config::Config{perladmin}/;
+ if (ord("A") == 193) { # EBCDIC.
+ $expect =~ s/item_mat%3c%21%3e/item_mat%4c%5a%6e/;
+ }
+
+ # result
+ open my $in, $outfile or die "cannot open $outfile: $!";
+ $result = <$in>;
+ close $in;
}
- # result
- open my $in, $outfile or die "cannot open $outfile: $!";
- my $result = <$in>;
- close $in;
- 1 while unlink $outfile;
+ ok($expect eq $result, $testname) or do {
+ my $diff = '/bin/diff';
+ -x $diff or $diff = '/usr/bin/diff';
+ if (-x $diff) {
+ my $expectfile = "pod2html-lib.tmp";
+ open my $tmpfile, ">", $expectfile or die $!;
+ print $tmpfile $expect;
+ close $tmpfile;
+ my $diffopt = $^O eq 'linux' ? 'u' : 'c';
+ open my $diff, "diff -$diffopt $expectfile $outfile |" or die $!;
+ print "# $_" while <$diff>;
+ close $diff;
+ unlink $expectfile;
+ }
+ };
- is($expect, $result, $testname);
# pod2html creates these
+ 1 while unlink $outfile;
1 while unlink "pod2htmd.x~~";
1 while unlink "pod2htmi.x~~";
}