+2011-07-18 Stefano Lattarini <stefano.lattarini@gmail.com>
+
+ 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 <stefano.lattarini@gmail.com>
tap: some preparatory refactoring (1)
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 "#")
{
sub testuite_error ($)
{
- add_test_result "ERROR";
- console_output "ERROR", "- $_[0]";
+ report "ERROR", "- $_[0]";
}
sub handle_tap_test ($)
$string .= " $explanation";
}
}
- add_test_result $test_result;
- console_output $test_result, $string;
+ report $test_result, $string;
}
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;
}
{
return unless $cfg{comments};
my $comment = $_[0]->comment;
- console_output "#", "$comment" if length $comment;
+ report "#", "$comment" if length $comment;
}
sub main (@)