Skip Menu |

Preferred bug tracker

Please visit the preferred bug tracker to report your issue.

This queue is for tickets about the Test-Simple CPAN distribution.

Report information
The Basics
Id: 29228
Status: rejected
Priority: 0/
Queue: Test-Simple

People
Owner: Nobody in particular
Requestors: schwern [...] pobox.com
Cc:
AdminCc:

Bug Information
Severity: Wishlist
Broken in: (no value)
Fixed in: (no value)



Subject: [Fwd: Re: bailout on first failure?]
Date: Fri, 07 Sep 2007 15:14:52 -0700
To: lee via RT <bug-Test-Simple [...] rt.cpan.org>
From: Michael G Schwern <schwern [...] pobox.com>
Show quoted text
-------- Original Message -------- Subject: Re: bailout on first failure? Date: Fri, 07 Sep 2007 15:34:52 -0400 From: Geoffrey Young <geoff@modperlcookbook.org> To: Scott McWhirter <scott-perl-qa@konobi.co.uk> CC: Greg Sabino Mullane <greg@endpoint.com>, Perl QA <perl-qa@perl.org> References: <46E16080.10901@modperlcookbook.org> <1189185818.15315.35.camel@greg-laptop> <d090cfd70709071035y161a8e9fyc2099bb798083ad8@mail.gmail.com> Scott McWhirter wrote:
> This would be easy to do in Test::Builder within &Test::Builder::ok by > making it call $Test->BAIL_OUT(); > > Then at least you would get it across all Test::* modules.
yeah, that's what I was implying in my followup message. the attached patch against 0.70 seems to do what I had in mind. --Geoff
--- lib/Test/Builder.pm 2007-09-07 15:33:04.000000000 -0400 +++ lib/Test/Builder.pm! 2007-09-07 15:32:30.000000000 -0400 @@ -196,6 +196,8 @@ $self->{No_Header} = 0; $self->{No_Ending} = 0; + $self->{Bail_Out_on_Failure} = 0; + $self->_dup_stdhandles unless $^C; return undef; @@ -457,6 +459,10 @@ } } + if (!$test && $self->{Bail_Out_on_Failure}) { + $self->BAIL_OUT('failure detected and bail_out_on_failure() set'); + } + return $test ? 1 : 0; } @@ -1130,9 +1136,17 @@ If set to true, no "1..N" header will be printed. +=item B<bail_out_on_failure> + + $Test->bail_out_on_failure($bail_out); + +Normally, Test::Builder continues right along on when a test fails. +By setting this to true a failure will call BAIL_OUT() and all +activity will be wrapped up as appropriate. + =cut -foreach my $attribute (qw(No_Header No_Ending No_Diag)) { +foreach my $attribute (qw(No_Header No_Ending No_Diag Bail_Out_on_Failure)) { my $method = lc $attribute; my $code = sub {
This will be handled with Test::Builder2 end of assert actions.