1use strict;
2use warnings;
3
4# This test checks for a pretty rare condition, one that was mainly a problem
5# on 5.20+ (though a 5.8 also had the problem). I am not too worried about this
6# breaking again. That said I still want it run on newer perls (where it is
7# less likely to fail for an unrelated reason) and when I have AUTHOR_TESTING
8# set.
9BEGIN {
10    unless($ENV{AUTHOR_TESTING} || eval "no warnings 'portable'; require 5.20; 1") {
11        print "1..0 # Skip Crazy test, only run on 5.20+, or when AUTHOR_TESTING is set\n";
12        exit 0;
13    }
14}
15
16# This test is for gh #16
17# Also see https://rt.perl.org/Public/Bug/Display.html?id=127774
18
19# Ceate this END before anything else so that $? gets set to 0
20END { $? = 0 }
21
22BEGIN {
23    print "\n1..1\n";
24    close(STDERR);
25    open(STDERR, '>&STDOUT');
26}
27
28use Test2::API;
29
30eval(' sub { die "xxx" } ')->();
31END {
32    sub { my $ctx = Test2::API::context(); $ctx->release; }->();
33    print "ok 1 - Did not segv\n";
34    $? = 0;
35}
36