Skip to content

Commit bdc905d

Browse files
committed
Unicode/UCD.t: better handling of errors
This now looks for the PERL_DIFF_TOOL environment variable, and if found uses that to display some problems. If not found, it uses is(), with a message that better output is available through setting this variable. PERL_DIFF_TOOL is a convention I wasn't familiar with.
1 parent 4911bc4 commit bdc905d

File tree

1 file changed

+9
-4
lines changed

1 file changed

+9
-4
lines changed

lib/Unicode/UCD.t

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1415,9 +1415,14 @@ sub fail_with_diff ($$$$) {
14151415
# For use below to output better messages
14161416
my ($prop, $official, $constructed, $tested_function_name) = @_;
14171417

1418-
is($constructed, $official, "$tested_function_name('$prop')");
1419-
diag("Comment out lines " . (__LINE__ - 1) . " through " . (__LINE__ + 1) . " in '$0' on Un*x-like systems to see just the differences. Uses the 'diff' first in your \$PATH");
1420-
return;
1418+
if (! $ENV{PERL_DIFF_TOOL}) {
1419+
1420+
is($constructed, $official, "$tested_function_name('$prop')");
1421+
1422+
diag("Set environment variable PERL_DIFF_TOOL=diff_tool to see just "
1423+
. "the differences.");
1424+
return;
1425+
}
14211426

14221427
fail("$tested_function_name('$prop')");
14231428

@@ -1434,7 +1439,7 @@ sub fail_with_diff ($$$$) {
14341439
close $gend || die "Can't close gend";
14351440

14361441
my $diff = File::Temp->new();
1437-
system("diff $off $gend > $diff");
1442+
system("$ENV{PERL_DIFF_TOOL} $off $gend > $diff");
14381443

14391444
open my $fh, "<", $diff || die "Can't open $diff";
14401445
my @diffs = <$fh>;

0 commit comments

Comments
 (0)