File: gh_16.t

package info (click to toggle)
perl 5.32.1-4%2Bdeb11u3
  • links: PTS, VCS
  • area: main
  • in suites: bullseye
  • size: 113,408 kB
  • sloc: ansic: 641,443; perl: 491,650; sh: 70,967; pascal: 8,354; cpp: 4,103; xml: 2,428; makefile: 2,237; yacc: 1,173; lisp: 1
file content (35 lines) | stat: -rw-r--r-- 979 bytes parent folder | download | duplicates (6)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
use strict;
use warnings;

# This test checks for a pretty rare condition, one that was mainly a problem
# on 5.20+ (though a 5.8 also had the problem). I am not too worried about this
# breaking again. That said I still want it run on newer perls (where it is
# less likely to fail for an unrelated reason) and when I have AUTHOR_TESTING
# set.
BEGIN {
    unless($ENV{AUTHOR_TESTING} || eval "no warnings 'portable'; require 5.20; 1") {
        print "1..0 # Skip Crazy test, only run on 5.20+, or when AUTHOR_TESTING is set\n";
        exit 0;
    }
}

# This test is for gh #16
# Also see https://rt.perl.org/Public/Bug/Display.html?id=127774

# Ceate this END before anything else so that $? gets set to 0
END { $? = 0 }

BEGIN {
    print "\n1..1\n";
    close(STDERR);
    open(STDERR, '>&STDOUT');
}

use Test2::API;

eval(' sub { die "xxx" } ')->();
END {
    sub { my $ctx = Test2::API::context(); $ctx->release; }->();
    print "ok 1 - Did not segv\n";
    $? = 0;
}