This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
Eliminate use of $::Message in t/re/pat_re_eval.t
[perl5.git] / ext / XS-APItest / t / my_exit.t
CommitLineData
6bd7445c
GG
1#!perl
2
3use strict;
4use warnings;
5
6require "test.pl";
7
8plan(4);
9
10use XS::APItest;
11
12my ($prog, $expect) = (<<'PROG', <<'EXPECT');
13use XS::APItest;
14print "ok\n";
15my_exit(1);
16print "not\n";
17PROG
18ok
19EXPECT
20fresh_perl_is($prog, $expect);
81693ff9
CB
21
22# C's EXIT_FAILURE ends up as SS$_ABORT (decimal 44) on VMS, which gets
23# shifted to 4. Perl_my_exit (unlike Perl_my_failure_exit) does not
24# have access to the vmsish pragmas to modify that behavior.
25
26my $exit_failure = $^O eq 'VMS' ? 4 : 1;
27is($? >> 8, $exit_failure, "exit code plain my_exit");
6bd7445c
GG
28
29($prog, $expect) = (<<'PROG', <<'EXPECT');
30use XS::APItest;
31print "ok\n";
32call_sv( sub { my_exit(1); }, G_EVAL );
33print "not\n";
34PROG
35ok
36EXPECT
37fresh_perl_is($prog, $expect);
81693ff9 38is($? >> 8, $exit_failure, "exit code my_exit inside a call_sv with G_EVAL");
6bd7445c 39