From 013d88601b5f575c83e86132806fa369987b3e75 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?agentzh=20=28=E7=AB=A0=E4=BA=A6=E6=98=A5=29?= Date: Sun, 6 Mar 2011 15:15:06 +0800 Subject: [PATCH] now we use Text::Diff in t/sanity.t. --- t/sanity.t | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/t/sanity.t b/t/sanity.t index 003c069..d92a9b3 100644 --- a/t/sanity.t +++ b/t/sanity.t @@ -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); +} +