diff options
author | Rafael Garcia-Suarez <rgarciasuarez@gmail.com> | 2006-06-12 14:08:09 +0000 |
---|---|---|
committer | Rafael Garcia-Suarez <rgarciasuarez@gmail.com> | 2006-06-12 14:08:09 +0000 |
commit | d1ef75db26a53db337bba97d4d09e1f6e1468cbe (patch) | |
tree | af248a6787c7d8675e76de5bf6a197ad1fa8bcb1 | |
parent | 89c3c464eb210f3e3f3128e3f8aa8c689a0cf55c (diff) | |
download | perl-d1ef75db26a53db337bba97d4d09e1f6e1468cbe.tar.gz |
Upgrade to Test::Harness 2.62
p4raw-id: //depot/perl@28384
-rw-r--r-- | MANIFEST | 1 | ||||
-rw-r--r-- | lib/Test/Harness.pm | 9 | ||||
-rw-r--r-- | lib/Test/Harness/Changes | 6 | ||||
-rw-r--r-- | lib/Test/Harness/t/failure.t | 40 |
4 files changed, 54 insertions, 2 deletions
@@ -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 92f2fd0199..6e8236d420 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 506cf140b0..479b82cf2a 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 0000000000..0e1b783acd --- /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" ); +} |