5 use Exception::Guaranteed;
11 guarantee_exception { die "Simple exception" }
13 like( $@, qr/^Simple exception/, 'A plain exception shoots through' );
19 __SelfDestruct->spawn_n_kill(sub {
20 die 'Exception outer';
24 while( $dummy < 2**31) {
28 $fail = 1; # we should never reach here
31 diag( ($dummy||0) . " inc-ops executed before kill-signal delivery (outer g_e)\n" );
32 ok (!$fail, 'execution stopped after trappable destroy exception');
33 like( $@, qr/^Exception outer/, 'DESTROY exception thrown and caught from outside' );
36 # when using the fork+signal based approach, I can't make the exception
37 # happen fast enough to not shoot out of its real containing eval :(
38 # Hence the dummy count here is essential
41 __SelfDestruct->spawn_n_kill( sub {
43 die 'Exception inner';
47 while( $dummy < 2**31) {
51 $fail = 1; # we should never reach here
54 diag( ($dummy||0) . " inc-ops executed before kill-signal delivery (DESTROY g_e)\n" );
55 ok (!$fail, 'execution stopped after trappable destroy exception');
56 like( $@, qr/^Exception inner/, 'DESTROY exception thrown and caught from inside of DESTROY block' );
58 # important, for the thread re-test
59 if ($ENV{EXCEPTION_GUARANTEED_SUBTEST}) {
60 $ENV{EXCEPTION_GUARANTEED_SUBTEST} = 42;