More verbose Test::Harness [PATCH]
Ilya Zakharevich [Tue, 22 Sep 1998 17:30:16 +0000 (13:30 -0400)]
Message-Id: <199809222130.RAA17034@monk.mps.ohio-state.edu>

p4raw-id: //depot/perl@1857

lib/Test/Harness.pm

index 9c61d3a..935e8f0 100644 (file)
@@ -160,7 +160,7 @@ sub runtests {
              } else {
                push @failed, $next..$max;
                $failed = @failed;
-               (my $txt, $canon) = canonfailed($max,@failed);
+               (my $txt, $canon) = canonfailed($max,$skipped,@failed);
                $percent = 100*(scalar @failed)/$max;
                print "DIED. ",$txt;
              }
@@ -173,7 +173,7 @@ sub runtests {
        } elsif ($ok == $max && $next == $max+1) {
            if ($max and $skipped + $bonus) {
                my @msg;
-               push(@msg, "$skipped subtest".($skipped>1?'s':'')." skipped")
+               push(@msg, "$skipped/$max subtest".($skipped>1?'s':'')." skipped")
                    if $skipped;
                push(@msg, "$bonus subtest".($bonus>1?'s':'').
                     " unexpectedly succeeded")
@@ -191,7 +191,7 @@ sub runtests {
                push @failed, $next..$max;
            }
            if (@failed) {
-               my ($txt, $canon) = canonfailed($max,@failed);
+               my ($txt, $canon) = canonfailed($max,$skipped,@failed);
                print $txt;
                $failedtests{$test} = { canon => $canon,  max => $max,
                                        failed => scalar @failed,
@@ -300,7 +300,7 @@ sub corestatus {
 }
 
 sub canonfailed ($@) {
-    my($max,@failed) = @_;
+    my($max,$skipped,@failed) = @_;
     my %seen;
     @failed = sort {$a <=> $b} grep !$seen{$_}++, @failed;
     my $failed = @failed;
@@ -330,7 +330,12 @@ sub canonfailed ($@) {
     }
 
     push @result, "\tFailed $failed/$max tests, ";
-    push @result, sprintf("%.2f",100*(1-$failed/$max)), "% okay\n";
+    push @result, sprintf("%.2f",100*(1-$failed/$max)), "% okay";
+    my $ender = 's' x ($skipped > 1);
+    my $good = $max - $failed - $skipped;
+    my $goodper = sprintf("%.2f",100*($good/$max));
+    push @result, " (-$skipped skipped test$ender: $good okay, $goodper%)" if $skipped;
+    push @result, "\n";
     my $txt = join "", @result;
     ($txt, $canon);
 }