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
CommitLineData
2c4d5b9b
SH
1#!/usr/bin/perl -w
2
3# What happens when a subtest dies?
4
5use lib 't/lib';
6
7use strict;
8use Test::Builder;
9use Test::Builder::NoOutput;
10
11my $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();