use strict;
use warnings;
-our $VERSION = '1.301001_089';
+our $VERSION = '1.301001_090';
$VERSION = eval $VERSION; ## no critic (BuiltinFunctions::ProhibitStringyEval)
require Exporter;
our @ISA = qw(Exporter);
-our $VERSION = '1.301001_089';
+our $VERSION = '1.301001_090';
$VERSION = eval $VERSION; ## no critic (BuiltinFunctions::ProhibitStringyEval)
package Test::Builder::Tester;
use strict;
-our $VERSION = '1.301001_089';
+our $VERSION = '1.301001_090';
$VERSION = eval $VERSION; ## no critic (BuiltinFunctions::ProhibitStringyEval)
use Test::Stream 1.301001 '-internal';
package Test::Builder::Tester::Color;
use strict;
-our $VERSION = '1.301001_089';
+our $VERSION = '1.301001_090';
$VERSION = eval $VERSION; ## no critic (BuiltinFunctions::ProhibitStringyEval)
use Test::Stream 1.301001 '-internal';
use strict;
use warnings;
-our $VERSION = '1.301001_089';
+our $VERSION = '1.301001_090';
$VERSION = eval $VERSION; ## no critic (BuiltinFunctions::ProhibitStringyEval)
use Test::Stream 1.301001 '-internal';
use strict;
use warnings;
-our $VERSION = '1.301001_089';
+our $VERSION = '1.301001_090';
$VERSION = eval $VERSION; ## no critic (BuiltinFunctions::ProhibitStringyEval)
-use Test::Stream 1.301001_089 '-internal';
+use Test::Stream 1.301001_090 '-internal';
use Test::Stream::Toolset;
use Test::Stream::Exporter;
use strict;
use warnings;
-our $VERSION = '1.301001_089';
+our $VERSION = '1.301001_090';
$VERSION = eval $VERSION; ## no critic (BuiltinFunctions::ProhibitStringyEval)
use Test::Stream::Context qw/context/;
sub init {
my $self = shift;
+ if ($self->[EXCEPTION] && !(blessed($self->[EXCEPTION]) && $self->[EXCEPTION]->isa('Test::Stream::Event'))) {
+ push @{$self->[DIAG]} => "Exception in subtest '$self->[NAME]': $self->[EXCEPTION]";
+ $self->[STATE]->[STATE_PASSING] = 0;
+ $self->[BOOL] = 0;
+ }
+
$self->[REAL_BOOL] = $self->[STATE]->[STATE_PASSING] && $self->[STATE]->[STATE_COUNT];
$self->[EVENTS] ||= [];
$ctx->set;
$ctx->restore_todo($todo);
+ $ctx->stream->subtest_exception->[-1] = $err unless $succ;
+
# This sends the subtest event
my $st = $ctx->child('pop', $name);
use vars qw( @ISA @EXPORT $VERSION );
-our $VERSION = '1.301001_089';
+our $VERSION = '1.301001_090';
$VERSION = eval $VERSION; ## no critic (BuiltinFunctions::ProhibitStringyEval)
@EXPORT = qw( run_tests check_tests check_test cmp_results show_space );
use warnings;
use 5.005;
-our $VERSION = '1.301001_089';
+our $VERSION = '1.301001_090';
$VERSION = eval $VERSION; ## no critic (BuiltinFunctions::ProhibitStringyEval)
use Test::Stream 1.301001 '-internal';
use Test::More 1.301001 ();
use Test::Stream::Carp qw/croak/;
-our $VERSION = '1.301001_089';
+our $VERSION = '1.301001_090';
$VERSION = eval $VERSION; ## no critic (BuiltinFunctions::ProhibitStringyEval)
sub import {
--- /dev/null
+use strict;
+use warnings;
+use Test::More;
+
+use Test::Stream::Tester;
+
+my ($ok, $err);
+events_are(
+ intercept {
+ $ok = eval {
+ subtest foo => sub {
+ ok(1, "Pass");
+ die "Ooops";
+ };
+ 1;
+ };
+ $err = $@;
+ },
+ check {
+ directive seek => 1;
+ event subtest => {
+ bool => 0,
+ real_bool => 0,
+ name => 'foo',
+ exception => qr/^Ooops/,
+ };
+ directive 'end';
+ },
+ "Subtest fails if it throws an exception"
+);
+
+ok(!$ok, "subtest died");
+like($err, qr/^Ooops/, "Got expected exception");
+
+done_testing;