Permalink
Browse files

More cleanups to Helper.pm.

  • Loading branch information...
1 parent 3dc282c commit fdcff91fe1588ca64733f91ca319216f1c5ecc1a @shlomif committed Oct 30, 2011
Showing with 12 additions and 8 deletions.
  1. +12 −8 t/Helper.pm
View
@@ -74,15 +74,19 @@ sub run_debugger($$;$$)
my $gotfile = $ext_file->('got');
- if ($right_string eq $output) {
- Test::More::ok(1);
- unlink $gotfile;
+ # TODO : Perhaps make sure we optionally use eq_or_diff from
+ # Test::Differences here.
+ if (Test::More::is($right_string, $output, 'Output comparison')) {
+ unlink $gotfile;
} else {
- my $diff = String::Diff::diff_merge($output, $right_string);
- open(GOT_FH, ">$gotfile");
- print GOT_FH $output;
- print $diff;
- Test::More::ok(0, "Output comparison fails");
+ my $diff = String::Diff::diff_merge($output, $right_string);
+
+ open (my $got_fh, '>', $gotfile)
+ or die "Cannot open '$gotfile' for writing - $!";
+ print {$got_fh} $output;
+ close($got_fh);
+
+ Test::More::diag($diff);
}
}

0 comments on commit fdcff91

Please sign in to comment.