Re: [ID 20010529.003] find2perl and File::Find doesn't emulate find when path is...
[p5sagit/p5-mst-13.2.git] / t / lib / test-harness.t
index 90326d9..a4c423d 100644 (file)
@@ -1,15 +1,16 @@
-#!./perl
+#!perl
 
 BEGIN {
     chdir 't' if -d 't';
     @INC = '../lib';
 }
 
+use strict;
 
 # For shutting up Test::Harness.
 package My::Dev::Null;
 use Tie::Handle;
-@ISA = qw(Tie::StdHandle);
+@My::Dev::Null::ISA = qw(Tie::StdHandle);
 
 sub WRITE { }
 
@@ -20,10 +21,11 @@ package main;
 my $test_num = 1;
 sub ok ($;$) {
     my($test, $name) = @_;
-    print "not " unless $test;
-    print "ok $test_num";
-    print " - $name" if defined $name;
-    print "\n";
+    my $okstring = '';
+    $okstring = "not " unless $test;
+    $okstring .= "ok $test_num";
+    $okstring .= " - $name" if defined $name;
+    print "$okstring\n";
     $test_num++;
 }
 
@@ -40,6 +42,7 @@ sub eqhash {
     return $ok;
 }
 
+use vars qw($Total_tests %samples);
 
 my $loaded;
 BEGIN { $| = 1; $^W = 1; }
@@ -55,7 +58,7 @@ BEGIN {
                 simple            => {
                                       bonus      => 0,
                                       max        => 5,
-                                      ok         => 5,
+                                      'ok'         => 5,
                                       files      => 1,
                                       bad        => 0,
                                       good       => 1,
@@ -66,7 +69,7 @@ BEGIN {
                 simple_fail      => {
                                      bonus       => 0,
                                      max         => 5,
-                                     ok          => 3,
+                                     'ok'          => 3,
                                      files       => 1,
                                      bad         => 1,
                                      good        => 0,
@@ -77,7 +80,7 @@ BEGIN {
                 descriptive       => {
                                       bonus      => 0,
                                       max        => 5,
-                                      ok         => 5,
+                                      'ok'         => 5,
                                       files      => 1,
                                       bad        => 0,
                                       good       => 1,
@@ -88,7 +91,7 @@ BEGIN {
                 no_nums           => {
                                       bonus      => 0,
                                       max        => 5,
-                                      ok         => 4,
+                                      'ok'         => 4,
                                       files      => 1,
                                       bad        => 1,
                                       good       => 0,
@@ -99,7 +102,7 @@ BEGIN {
                 todo              => {
                                       bonus      => 1,
                                       max        => 5,
-                                      ok         => 5,
+                                      'ok'         => 5,
                                       files      => 1,
                                       bad        => 0,
                                       good       => 1,
@@ -110,7 +113,7 @@ BEGIN {
                 skip              => {
                                       bonus      => 0,
                                       max        => 5,
-                                      ok         => 5,
+                                      'ok'         => 5,
                                       files      => 1,
                                       bad        => 0,
                                       good       => 1,
@@ -122,7 +125,7 @@ BEGIN {
                 combined          => {
                                       bonus      => 1,
                                       max        => 10,
-                                      ok         => 8,
+                                      'ok'         => 8,
                                       files      => 1,
                                       bad        => 1,
                                       good       => 0,
@@ -133,7 +136,7 @@ BEGIN {
                 duplicates        => {
                                       bonus      => 0,
                                       max        => 10,
-                                      ok         => 11,
+                                      'ok'         => 11,
                                       files      => 1,
                                       bad        => 1,
                                       good       => 0,
@@ -144,7 +147,7 @@ BEGIN {
                 header_at_end     => {
                                       bonus      => 0,
                                       max        => 4,
-                                      ok         => 4,
+                                      'ok'         => 4,
                                       files      => 1,
                                       bad        => 0,
                                       good       => 1,
@@ -155,7 +158,7 @@ BEGIN {
                 skip_all          => {
                                       bonus      => 0,
                                       max        => 0,
-                                      ok         => 0,
+                                      'ok'         => 0,
                                       files      => 1,
                                       bad        => 0,
                                       good       => 1,
@@ -166,7 +169,7 @@ BEGIN {
                 with_comments     => {
                                       bonus      => 2,
                                       max        => 5,
-                                      ok         => 5,
+                                      'ok'         => 5,
                                       files      => 1,
                                       bad        => 0,
                                       good       => 1,
@@ -182,12 +185,12 @@ BEGIN {
 tie *NULL, 'My::Dev::Null' or die $!;
 
 while (my($test, $expect) = each %samples) {
-    # _runtests() runs the tests but skips the formatting.
+    # _run_all_tests() runs the tests but skips the formatting.
     my($totals, $failed);
     eval {
-        select NULL;    # _runtests() isn't as quiet as it should be.
+        select NULL;    # _run_all_tests() isn't as quiet as it should be.
         ($totals, $failed) = 
-          Test::Harness::_runtests("lib/sample-tests/$test");
+          Test::Harness::_run_all_tests("lib/sample-tests/$test");
     };
     select STDOUT;