This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
svleak.t: Enable syntax error tests under -Dmad
[perl5.git] / t / op / magic_phase.t
1 #!./perl
2
3 use strict;
4 use warnings;
5
6 # Test ${^GLOBAL_PHASE}
7 #
8 # Test::More, test.pl, etc assert plans in END, which happens before global
9 # destruction, so we don't want to use those here.
10
11 BEGIN { print "1..7\n" }
12
13 sub ok ($$) {
14     print "not " if !$_[0];
15     print "ok";
16     print " - $_[1]" if defined $_[1];
17     print "\n";
18 }
19
20 BEGIN {
21     ok ${^GLOBAL_PHASE} eq 'START', 'START';
22 }
23
24 CHECK {
25     ok ${^GLOBAL_PHASE} eq 'CHECK', 'CHECK';
26 }
27
28 INIT {
29     ok ${^GLOBAL_PHASE} eq 'INIT', 'INIT';
30 }
31
32 ok ${^GLOBAL_PHASE} eq 'RUN', 'RUN';
33
34 sub Moo::DESTROY {
35     ok ${^GLOBAL_PHASE} eq 'RUN', 'DESTROY is run-time too, usually';
36 }
37
38 my $tiger = bless {}, Moo::;
39
40 sub Kooh::DESTROY {
41     ok ${^GLOBAL_PHASE} eq 'DESTRUCT', 'DESTRUCT';
42 }
43
44 our $affe = bless {}, Kooh::;
45
46 END {
47     ok ${^GLOBAL_PHASE} eq 'END', 'END';
48 }