From: Jarkko Hietaniemi Date: Fri, 13 Jun 2003 17:02:57 +0000 (+0000) Subject: Somehow MPE/iX managed to get X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=e93c26866c986e7bac464b29ce847567d40a6e91;p=p5sagit%2Fp5-mst-13.2.git Somehow MPE/iX managed to get "18/0Illegal division by zero at ../lib/Test/Harness.pm line 921." p4raw-id: //depot/perl@19766 --- diff --git a/lib/Test/Harness.pm b/lib/Test/Harness.pm index 4c4576a..7534a34 100644 --- a/lib/Test/Harness.pm +++ b/lib/Test/Harness.pm @@ -918,13 +918,23 @@ sub canonfailed ($@) { } push @result, "\tFailed $failed/$max tests, "; - push @result, sprintf("%.2f",100*(1-$failed/$max)), "% okay"; + if ($max) { + push @result, sprintf("%.2f",100*(1-$failed/$max)), "% okay"; + } else { + push @result, "?% okay"; + } my $ender = 's' x ($skipped > 1); my $good = $max - $failed - $skipped; - my $goodper = sprintf("%.2f",100*($good/$max)); - push @result, " (less $skipped skipped test$ender: $good okay, ". - "$goodper%)" - if $skipped; + if ($skipped) { + my $skipmsg = " (less $skipped skipped test$ender: $good okay, "; + if ($max) { + my $goodper = sprintf("%.2f",100*($good/$max)); + $skipmsg .= "$goodper%)"; + } else { + $skipmsg .= "?%)"; + } + push @result, $skipmsg; + } push @result, "\n"; my $txt = join "", @result; ($txt, $canon);