Mailing List Archive

Tiny patch for Test::Harness to make failure handling consistent
Currently Test::Harness does a die "..." if more than one test fails
but just does a warn "..." if only one test fails.

This is not only inconsistent it affects MakeMaker generated Makefiles
which use:

perl -e 'use Test::Harness; runtests @ARGV;' t/*.t
perl test.pl

It's easy to miss a single test failing since make goes on to run
test.pl which may produce much output (like the DBI test.pl does).

The following patch over 5.001m fixes this:

diff -c2 ./lib/Test/Harness.pm.1m ./lib/Test/Harness.pm
*** ./lib/Test/Harness.pm.1m Mon Sep 11 11:55:20 1995
--- ./lib/Test/Harness.pm Mon Sep 11 11:56:35 1995
***************
*** 70,74 ****
$pct = sprintf("%.2f", $good / $total * 100);
if ($bad == 1) {
! warn "Failed 1 test, $pct% okay.\n";
} else {
die "Failed $bad/$total tests, $pct% okay.\n";
--- 70,74 ----
$pct = sprintf("%.2f", $good / $total * 100);
if ($bad == 1) {
! die "Failed 1 test, $pct% okay.\n";
} else {
die "Failed $bad/$total tests, $pct% okay.\n";

Tim.