Upgrade to Test::Harness 2.62
authorRafael Garcia-Suarez <rgarciasuarez@gmail.com>
Mon, 12 Jun 2006 14:08:09 +0000 (14:08 +0000)
committerRafael Garcia-Suarez <rgarciasuarez@gmail.com>
Mon, 12 Jun 2006 14:08:09 +0000 (14:08 +0000)
p4raw-id: //depot/perl@28384

MANIFEST
lib/Test/Harness.pm
lib/Test/Harness/Changes
lib/Test/Harness/t/failure.t [new file with mode: 0644]

index f04c50d..dbd71ac 100644 (file)
--- 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
index 92f2fd0..6e8236d 100644 (file)
@@ -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;
 }
 
index 506cf14..479b82c 100644 (file)
@@ -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 (file)
index 0000000..0e1b783
--- /dev/null
@@ -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" );
+}