This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
Test the prev commit
[perl5.git] / cpan / Test-Simple / t / subtest / die.t
1 #!/usr/bin/perl -w
2
3 # What happens when a subtest dies?
4
5 use lib 't/lib';
6
7 use strict;
8 use Test::Builder;
9 use Test::Builder::NoOutput;
10
11 my $Test = Test::Builder->new;
12
13 {
14     my $tb = Test::Builder::NoOutput->create;
15
16     $tb->ok(1);
17
18     $Test->ok( !eval {
19         $tb->subtest("death" => sub {
20             die "Death in the subtest";
21         });
22         1;
23     });
24     $Test->like( $@, qr/^Death in the subtest at $0 line /);
25
26     $Test->ok( !$tb->parent, "the parent object is restored after a die" );
27 }
28
29
30 $Test->done_testing();