Skip Menu |

This queue is for tickets about the Test-Harness CPAN distribution.

Report information
The Basics
Id: 17403
Status: rejected
Priority: 0/
Queue: Test-Harness

People
Owner: Nobody in particular
Requestors: sthoenna [...] efn.org
Cc:
AdminCc:

Bug Information
Severity: (no value)
Broken in: (no value)
Fixed in: (no value)



Subject: Re: OK: perl v5..9.3 on aix 4.2 : only one test fails
Date: Tue, 31 Jan 2006 11:15:26 -0800
To: bug-Test-Harness [...] rt.cpan.org
From: Yitzchak Scott-Thoennes <sthoenna [...] efn.org>
On Tue, Jan 31, 2006 at 12:56:25PM -0300, Jos? AUGUSTE-ETIENNE wrote: Show quoted text
> Failed 1/1192 test scripts, 99.92% okay. 1/160196 subtests failed, > 100.00% okay.
That output could stand to be tweaked to say 99.9994% okay. --- lib/Test/Harness.pm.orig 2005-09-28 16:28:56.000000000 -0700 +++ lib/Test/Harness.pm 2006-01-31 10:41:41.699552000 -0800 @@ -550,6 +550,20 @@ } +sub _percent_ok { + my ($ok, $max) = @_; + my $pct = sprintf "%.2f", 100 * $ok / $max; + + # never show < 100% as 100.00; show e.g. 99.9994 instead + if ($pct eq "100.00" && $ok < $max) { + # the |.* shouldn't be needed but makes sure *something* gets output + ($pct) = ($ok / $max * 100) =~ /^(99\.99+\d|.*)/; + } + + return $pct; +} + + sub _show_results { my($tot, $failedtests) = @_; @@ -569,8 +583,8 @@ } else { $pct = sprintf("%.2f", $tot->{good} / $tot->{tests} * 100); - my $percent_ok = 100*$tot->{ok}/$tot->{max}; - my $subpct = sprintf " %d/%d subtests failed, %.2f%% okay.", + my $percent_ok = _percent_ok($tot->{ok}, $tot->{max}); + my $subpct = sprintf " %d/%d subtests failed, %s%% okay.", $tot->{max} - $tot->{ok}, $tot->{max}, $percent_ok;
As of 2.57_06, there are no percentages reported, so this problem no longer applies. Thanks for the patch, though.