diff options
author | Craig A. Berry <craigberry@mac.com> | 2012-02-26 09:07:42 -0600 |
---|---|---|
committer | Craig A. Berry <craigberry@mac.com> | 2012-02-28 19:13:42 -0600 |
commit | 12fddd398f7ab89902312f4663cdc9990618bd45 (patch) | |
tree | 0d677938272d2e1f826422872996639b060b644c | |
parent | 0c2829400b005cbfc6543affe3aa5a63616b7498 (diff) | |
download | perl-12fddd398f7ab89902312f4663cdc9990618bd45.tar.gz |
Different differences for Pod::Html tests.
Windows has FC (file compare), VMS has DIFFERENCES, and Linux is
certainly not the only OS that can do unified diff.
-rw-r--r-- | ext/Pod-Html/t/pod2html-lib.pl | 22 |
1 files changed, 12 insertions, 10 deletions
diff --git a/ext/Pod-Html/t/pod2html-lib.pl b/ext/Pod-Html/t/pod2html-lib.pl index c03f38af9b..0327e2bde3 100644 --- a/ext/Pod-Html/t/pod2html-lib.pl +++ b/ext/Pod-Html/t/pod2html-lib.pl @@ -69,23 +69,25 @@ sub convert_n_test { my $diff = '/bin/diff'; -x $diff or $diff = '/usr/bin/diff'; - if (-x $diff) { + -x $diff or $diff = undef; + my $diffopt = $diff ? $^O =~ m/(linux|darwin)/ ? '-u' : '-c' + : ''; + $diff = 'fc/n' if $^O =~ /^MSWin/; + $diff = 'differences' if $^O eq 'VMS'; + if ($diff) { ok($expect eq $result, $testname) or do { - my $expectfile = "pod2html-lib.tmp"; + my $expectfile = "${podfile}_expected.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; + open my $diff_fh, "$diff $diffopt $expectfile $outfile |" or die $!; + print STDERR "# $_" while <$diff_fh>; + close $diff_fh; 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 + # This is fairly evil, but lets us get detailed failure modes + # anywhere that we've failed to identify a diff program. is($expect, $result, $testname); } |