From: Rafael Garcia-Suarez Date: Mon, 12 Jun 2006 14:08:09 +0000 (+0000) Subject: Upgrade to Test::Harness 2.62 X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=d1ef75db26a53db337bba97d4d09e1f6e1468cbe;p=p5sagit%2Fp5-mst-13.2.git Upgrade to Test::Harness 2.62 p4raw-id: //depot/perl@28384 --- diff --git a/MANIFEST b/MANIFEST index f04c50d..dbd71ac 100644 --- a/MANIFEST +++ b/MANIFEST @@ -2402,6 +2402,7 @@ lib/Test/Harness/TAP.pod Documentation for the Test Anything Protocol lib/Test/Harness/t/assert.t Test::Harness::Assert test lib/Test/Harness/t/base.t Test::Harness test lib/Test/Harness/t/callback.t Test::Harness test +lib/Test/Harness/t/failure.t Test::Harness test lib/Test/Harness/t/from_line.t Test::Harness test lib/Test/Harness/t/harness.t Test::Harness test lib/Test/Harness/t/inc_taint.t Test::Harness test diff --git a/lib/Test/Harness.pm b/lib/Test/Harness.pm index 92f2fd0..6e8236d 100644 --- a/lib/Test/Harness.pm +++ b/lib/Test/Harness.pm @@ -34,11 +34,11 @@ Test::Harness - Run Perl standard test scripts with statistics =head1 VERSION -Version 2.60 +Version 2.62 =cut -$VERSION = '2.60'; +$VERSION = '2.62'; # Backwards compatibility for exportable variable names. *verbose = *Verbose; @@ -214,6 +214,11 @@ sub runtests { assert(($ok xor keys %$failedtests), q{ok status jives with $failedtests}); + if (! $ok) { + die("Failed $tot->{bad}/$tot->{tests} test programs. " . + "@{[$tot->{max} - $tot->{ok}]}/$tot->{max} subtests failed.\n"); + } + return $ok; } diff --git a/lib/Test/Harness/Changes b/lib/Test/Harness/Changes index 506cf14..479b82c 100644 --- a/lib/Test/Harness/Changes +++ b/lib/Test/Harness/Changes @@ -1,5 +1,11 @@ Revision history for Perl extension Test::Harness +2.62 Thu Jun 8 14:11:57 CDT 2006 + [FIXES] + * Restored the behavior of dying if any subtests failed. This is a + pretty crucial bug that I should have fixed long ago. Not having this + means that CPANPLUS will install modules even if their tests fail. :-( + 2.60 Wed May 24 14:48:44 CDT 2006 [FIXES] * Fixed the headers in the summary failure table. diff --git a/lib/Test/Harness/t/failure.t b/lib/Test/Harness/t/failure.t new file mode 100644 index 0000000..0e1b783 --- /dev/null +++ b/lib/Test/Harness/t/failure.t @@ -0,0 +1,40 @@ +#!/usr/bin/perl -w + +BEGIN { + if ( $ENV{PERL_CORE} ) { + chdir 't'; + @INC = ('../lib', 'lib'); + } + else { + unshift @INC, 't/lib'; + } +} + +use strict; + +use Test::More tests => 6; + +BEGIN { + use_ok( 'Test::Harness' ); +} + +my $died; +sub prepare_for_death { $died = 0; } +sub signal_death { $died = 1; } + +PASSING: { + local $SIG{__DIE__} = \&signal_death; + prepare_for_death(); + eval { runtests( "t/sample-tests/simple" ) }; + ok( !$@, "simple lives" ); + is( $died, 0, "Death never happened" ); +} + +FAILING: { + local $SIG{__DIE__} = \&signal_death; + prepare_for_death(); + eval { runtests( "t/sample-tests/too_many" ) }; + ok( $@, "$@" ); + ok( $@ =~ m[Failed 1/1], "too_many dies" ); + is( $died, 1, "Death happened" ); +}