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