From: Stefano Lattarini Date: Sun, 17 Jul 2011 14:04:06 +0000 (+0200) Subject: tap: some preparatory refactoring (2) X-Git-Tag: ng-0.5a~89^2~155^2~18 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=7858f2bbb985536317fe2b5285ea332db96161c9;p=thirdparty%2Fautomake.git tap: some preparatory refactoring (2) This is a follow-up simplification. * lib/tap-driver (console_output): Renamed ... (report): ... to this, and extended to appropriately register the test results when needed. (testsuite_error, handle_tap_comment, handle_tap_test, handle_tap_plan): Adjusted accordingly. --- diff --git a/ChangeLog b/ChangeLog index 941d74717..6ee3fd5b9 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,13 @@ +2011-07-18 Stefano Lattarini + + tap: some preparatory refactoring (2) + This is a follow-up simplification. + * lib/tap-driver (console_output): Renamed ... + (report): ... to this, and extended to appropriately register + the test results when needed. + (testsuite_error, handle_tap_comment, handle_tap_test, + handle_tap_plan): Adjusted accordingly. + 2011-07-18 Stefano Lattarini tap: some preparatory refactoring (1) diff --git a/lib/tap-driver b/lib/tap-driver index eb505dea1..b669292b9 100755 --- a/lib/tap-driver +++ b/lib/tap-driver @@ -211,12 +211,13 @@ sub stringify_test_result ($) die "INTERNAL ERROR"; # NOTREACHED } -sub console_output ($;$) +sub report ($;$) { my ($msg, $result, $explanation) = (undef, @_); if ($result =~ /^(?:X?(?:PASS|FAIL)|SKIP|ERROR)/) { $msg = "$result: $test_script_name"; + add_test_result $result; } elsif ($result eq "#") { @@ -236,8 +237,7 @@ sub console_output ($;$) sub testuite_error ($) { - add_test_result "ERROR"; - console_output "ERROR", "- $_[0]"; + report "ERROR", "- $_[0]"; } sub handle_tap_test ($) @@ -268,8 +268,7 @@ sub handle_tap_test ($) $string .= " $explanation"; } } - add_test_result $test_result; - console_output $test_result, $string; + report $test_result, $string; } sub handle_tap_plan ($) @@ -288,8 +287,7 @@ sub handle_tap_plan ($) if not defined $plan->directive && length ($plan->directive) > 0; my $explanation = $plan->explanation ? "- " . $plan->explanation : undef; - add_test_result "SKIP"; - console_output "SKIP", $explanation; + report "SKIP", $explanation; finish; } @@ -305,7 +303,7 @@ sub handle_tap_comment ($) { return unless $cfg{comments}; my $comment = $_[0]->comment; - console_output "#", "$comment" if length $comment; + report "#", "$comment" if length $comment; } sub main (@)