From: Nicholas Clark Date: Thu, 27 Aug 2009 13:26:20 +0000 (+0100) Subject: t/harness and t/TEST can both use the same _run_test() to invoke tests. X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=744c27e5aa4aa3ee30df5711b0799332655b563e;p=p5sagit%2Fp5-mst-13.2.git t/harness and t/TEST can both use the same _run_test() to invoke tests. Now the logic to invoke tests is in exactly one place, we can refactor it with impunity. --- diff --git a/t/TEST b/t/TEST index 6589ee2..4c2868d 100755 --- a/t/TEST +++ b/t/TEST @@ -150,7 +150,11 @@ my %dir_to_switch = ); sub _run_test { - my($test, $type) = @_; + my($harness, $test, $type) = @_; + if (!defined $type) { + # To conform to the interface expected by exec in TAP::Harness + $type = 'perl'; + } my $options = _scan_test($test, $type); @@ -394,7 +398,7 @@ EOT $te = ''; } - my $results = _run_test($test, $type); + my $results = _run_test(undef, $test, $type); my $failure; my $next = 0; diff --git a/t/harness b/t/harness index 11c1741..660e584 100644 --- a/t/harness +++ b/t/harness @@ -208,6 +208,7 @@ my $h = TAP::Harness->new({ color => $color, jobs => $jobs, verbosity => $Verbose, + exec => \&_run_test, }); if ($state) {