t/harness and t/TEST can both use the same _run_test() to invoke tests.
Nicholas Clark [Thu, 27 Aug 2009 13:26:20 +0000 (14:26 +0100)]
Now the logic to invoke tests is in exactly one place, we can refactor it with
impunity.

t/TEST
t/harness

diff --git a/t/TEST b/t/TEST
index 6589ee2..4c2868d 100755 (executable)
--- 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;
index 11c1741..660e584 100644 (file)
--- 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) {