now we use Text::Diff in t/sanity.t.
This commit is contained in:
parent
64c3ab1146
commit
013d88601b
15
t/sanity.t
15
t/sanity.t
|
@ -2,7 +2,7 @@ use strict;
|
||||||
use warnings;
|
use warnings;
|
||||||
|
|
||||||
use Test::More tests => 1;
|
use Test::More tests => 1;
|
||||||
use Test::Differences;
|
use Text::Diff;
|
||||||
|
|
||||||
sub shell (@);
|
sub shell (@);
|
||||||
sub cd ($);
|
sub cd ($);
|
||||||
|
@ -25,7 +25,7 @@ open $in, "../t/help.txt" or
|
||||||
my $expected = do { local $/; <$in> };
|
my $expected = do { local $/; <$in> };
|
||||||
close $in;
|
close $in;
|
||||||
|
|
||||||
eq_or_diff $got, $expected, "--help ok";
|
is_diff($got, $expected, "--help ok");
|
||||||
|
|
||||||
sub shell (@) {
|
sub shell (@) {
|
||||||
print "@_\n";
|
print "@_\n";
|
||||||
|
@ -38,3 +38,14 @@ sub cd ($) {
|
||||||
chdir $dir or die "failed to cd $dir: $!\n";
|
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);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue