Author: dagolden
Date: Mon Sep  7 18:14:39 2009
New Revision: 13286

Modified:
   Module-Build/trunk/Changes
   Module-Build/trunk/lib/Module/Build/Base.pm
   Module-Build/trunk/t/use_tap_harness.t

Log:
Simplify error message on exit under TAP::Harness

Modified: Module-Build/trunk/Changes
==============================================================================
--- Module-Build/trunk/Changes  (original)
+++ Module-Build/trunk/Changes  Mon Sep  7 18:14:39 2009
@@ -21,6 +21,8 @@
    references to new objects. Changed so that defaults are cloned instead.
    (This mostly affects testing, which often creates multiple objects in the
    same process) [David Golden]
+ - Simplified error message on exit under use_tap_harness [suggested by
+   David Wheeler]
 
  Other:
  - Replaced guts of new_from_context().  Build.PL is now executed in a

Modified: Module-Build/trunk/lib/Module/Build/Base.pm
==============================================================================
--- Module-Build/trunk/lib/Module/Build/Base.pm (original)
+++ Module-Build/trunk/lib/Module/Build/Base.pm Mon Sep  7 18:14:39 2009
@@ -2335,7 +2335,9 @@
     my $args = $self->tap_harness_args;
     if($self->use_tap_harness or ($args and %$args)) {
       my $aggregate = $self->run_tap_harness($tests);
-      $self->_tap_harness_exit($aggregate) if $aggregate->has_errors;
+      if ( $aggregate->has_errors ) {
+        die "Errors in testing.  Cannot continue.\n";
+      }
     }
     else {
       $self->run_test_harness($tests);
@@ -2365,28 +2367,6 @@
   return $aggregate;
 }
 
-# Emulate death on failure behavior of Test::Harness
-sub _tap_harness_exit {
-  my ($self, $aggregate) = @_;
-
-  my $total  = $aggregate->total;
-  my $passed = $aggregate->passed;
-  my $failed = $aggregate->failed;
-
-  my @parsers = $aggregate->parsers;
-
-  my $num_bad = 0;
-  for my $parser (@parsers) {
-    $num_bad++ if $parser->has_problems;
-  }
-
-  die(sprintf(
-      "Failed %d/%d test programs. %d/%d subtests failed.\n",
-      $num_bad, scalar @parsers, $failed, $total
-    )
-  ) if $num_bad;
-}
-
 sub run_test_harness {
     my ($self, $tests) = @_;
     require Test::Harness;

Modified: Module-Build/trunk/t/use_tap_harness.t
==============================================================================
--- Module-Build/trunk/t/use_tap_harness.t      (original)
+++ Module-Build/trunk/t/use_tap_harness.t      Mon Sep  7 18:14:39 2009
@@ -87,7 +87,7 @@
 # Use uc() so we don't confuse the current test output
 $out = stdout_stderr_of( sub { $dist->run_build('test')} );
 ok( $?, "'Build test' had non-zero exit code" );
-like( $out, qr{Failed 1/1 test programs. 1/1 subtests failed\.}, 
+like( $out, qr{Errors in testing\.  Cannot continue\.}, 
     "Saw emulated Test::Harness die() message" 
 );
 

Reply via email to