now we use Text::Diff in t/sanity.t.

This commit is contained in:
agentzh (章亦春) 2011-03-06 15:15:06 +08:00
parent 64c3ab1146
commit 013d88601b
1 changed files with 13 additions and 2 deletions

View File

@ -2,7 +2,7 @@ use strict;
use warnings;
use Test::More tests => 1;
use Test::Differences;
use Text::Diff;
sub shell (@);
sub cd ($);
@ -25,7 +25,7 @@ open $in, "../t/help.txt" or
my $expected = do { local $/; <$in> };
close $in;
eq_or_diff $got, $expected, "--help ok";
is_diff($got, $expected, "--help ok");
sub shell (@) {
print "@_\n";
@ -38,3 +38,14 @@ sub cd ($) {
chdir $dir or die "failed to cd $dir: $!\n";
}
sub is_diff {
my ($actual, $expected, $name) = @_;
if (!defined $name) {
$name = '';
}
ok $actual eq $expected,
$name . "\n" . Text::Diff::diff(\$expected, \$actual);
}