summaryrefslogtreecommitdiffstats
path: root/gnu/usr.bin/perl/cpan/Test-Simple/t/Legacy/dont_overwrite_die_handler.t
blob: 09b700787d1f6e5bf32ff2f5764248f621e156c9 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
#!/usr/bin/perl -w
use Config; # To prevent conflict with some strawberry-portable versions

BEGIN {
    if( $ENV{PERL_CORE} ) {
        chdir 't';
        @INC = '../lib';
    }
}

use Carp qw/cluck/;

# Make sure this is in place before Test::More is loaded.
my $started = 0;
my $handler_called;
BEGIN {
    $SIG{__DIE__} = sub { $handler_called++; cluck 'Died early!' unless $started };
}

use Test::More tests => 2;

$started = 1;
ok !eval { die };
is $handler_called, 1, 'existing DIE handler not overridden';