diff options
author | Ricardo Signes <rjbs@cpan.org> | 2012-02-22 19:24:22 -0500 |
---|---|---|
committer | Ricardo Signes <rjbs@cpan.org> | 2012-02-22 19:26:41 -0500 |
commit | 895e2c0f6b4f6e66f85fb2df734c74c6d722d2a3 (patch) | |
tree | 9293b93abb49c182de1765ba36ddde0ca0e7823b | |
parent | b0cd92fc1e61f03bceba148fd1b00600c54a7f81 (diff) | |
download | perl-895e2c0f6b4f6e66f85fb2df734c74c6d722d2a3.tar.gz |
work harder to get useful diagnostics on Win32
The pod2html tests can do diffs of big hunks, and so they try to
use /usr/bin/diff to show how things differ. If there is no such
program, we just say "it wasn't good."
Unfortunately, Win32 is where we keep having problems, and where
we are least likely to have diff available. When there is no diff,
we now use Test::More::is, which will output the whole differing file.
Noisy, yes, but now smoke reports with failing Pod::Html tests will
be more useful.
-rw-r--r-- | ext/Pod-Html/t/crossref2.t | 4 | ||||
-rw-r--r-- | ext/Pod-Html/t/pod2html-lib.pl | 36 |
2 files changed, 23 insertions, 17 deletions
diff --git a/ext/Pod-Html/t/crossref2.t b/ext/Pod-Html/t/crossref2.t index b4e0f65503..3257928028 100644 --- a/ext/Pod-Html/t/crossref2.t +++ b/ext/Pod-Html/t/crossref2.t @@ -17,10 +17,10 @@ use Test::More tests => 1; SKIP: { my $output = make_test_dir(); skip "$output", 1 if $output; - + my $cwd = cwd(); - convert_n_test("crossref", "cross references", + convert_n_test("crossref", "cross references", "--podpath=t:testdir/test.lib", "--podroot=$cwd", "--htmldir=$cwd", diff --git a/ext/Pod-Html/t/pod2html-lib.pl b/ext/Pod-Html/t/pod2html-lib.pl index 1b2da25dea..c03f38af9b 100644 --- a/ext/Pod-Html/t/pod2html-lib.pl +++ b/ext/Pod-Html/t/pod2html-lib.pl @@ -67,21 +67,27 @@ sub convert_n_test { close $in; } - 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; - } - }; + my $diff = '/bin/diff'; + -x $diff or $diff = '/usr/bin/diff'; + if (-x $diff) { + ok($expect eq $result, $testname) or do { + 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 STDERR "# $_" while <$diff>; + close $diff; + unlink $expectfile; + }; + } else { + # This is fairly evil, but lets us get detailed failure modes on + # Win32, where we have the most trouble working and the least chance of + # having diff in /bin or /usr/bin! (Invoking diff in our tests is + # pretty evil, too, so...) -- rjbs, 2012-02-22 + is($expect, $result, $testname); + } # pod2html creates these 1 while unlink $outfile; |