This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
Test-Simple Version Bump, 1.301001_090 (RC10)
authorChad Granum <chad.granum@dreamhost.com>
Mon, 15 Dec 2014 02:09:12 +0000 (03:09 +0100)
committerAristotle Pagaltzis <pagaltzis@gmx.de>
Mon, 15 Dec 2014 02:09:12 +0000 (03:09 +0100)
13 files changed:
cpan/Test-Simple/lib/Test/Builder.pm
cpan/Test-Simple/lib/Test/Builder/Module.pm
cpan/Test-Simple/lib/Test/Builder/Tester.pm
cpan/Test-Simple/lib/Test/Builder/Tester/Color.pm
cpan/Test-Simple/lib/Test/More.pm
cpan/Test-Simple/lib/Test/Simple.pm
cpan/Test-Simple/lib/Test/Stream.pm
cpan/Test-Simple/lib/Test/Stream/Event/Subtest.pm
cpan/Test-Simple/lib/Test/Stream/Subtest.pm
cpan/Test-Simple/lib/Test/Tester.pm
cpan/Test-Simple/lib/Test/use/ok.pm
cpan/Test-Simple/lib/ok.pm
cpan/Test-Simple/t/Behavior/subtest_die.t [new file with mode: 0644]

index 05ac575..099d389 100644 (file)
@@ -4,7 +4,7 @@ use 5.008001;
 use strict;
 use warnings;
 
-our $VERSION = '1.301001_089';
+our $VERSION = '1.301001_090';
 $VERSION = eval $VERSION;    ## no critic (BuiltinFunctions::ProhibitStringyEval)
 
 
index ebc4d20..c5baa2c 100644 (file)
@@ -8,7 +8,7 @@ use Test::Builder 0.99;
 require Exporter;
 our @ISA = qw(Exporter);
 
-our $VERSION = '1.301001_089';
+our $VERSION = '1.301001_090';
 $VERSION = eval $VERSION;      ## no critic (BuiltinFunctions::ProhibitStringyEval)
 
 
index 53ec73b..688dace 100644 (file)
@@ -1,7 +1,7 @@
 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';
index ffc79cf..f8646b5 100644 (file)
@@ -1,7 +1,7 @@
 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';
index 3c6b0e6..5744c22 100644 (file)
@@ -4,7 +4,7 @@ use 5.008001;
 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';
index 3427368..4da7713 100644 (file)
@@ -5,10 +5,10 @@ use 5.008001;
 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;
index d775edb..1558eb0 100644 (file)
@@ -2,7 +2,7 @@ package Test::Stream;
 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/;
index 4557796..f29636a 100644 (file)
@@ -21,6 +21,12 @@ sub subevents {
 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] ||= [];
 
index 4540758..39533e4 100644 (file)
@@ -62,6 +62,8 @@ This is almost certainly not what you wanted. Did you fork and forget to exit?
 
     $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);
 
index 2f67eda..072ea77 100644 (file)
@@ -16,7 +16,7 @@ require Exporter;
 
 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 );
index cd2698e..27d4721 100644 (file)
@@ -3,7 +3,7 @@ use strict;
 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';
index c757203..db4995a 100644 (file)
@@ -6,7 +6,7 @@ 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 {
diff --git a/cpan/Test-Simple/t/Behavior/subtest_die.t b/cpan/Test-Simple/t/Behavior/subtest_die.t
new file mode 100644 (file)
index 0000000..49f8f88
--- /dev/null
@@ -0,0 +1,35 @@
+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;