summaryrefslogtreecommitdiffstats
path: root/gnu/usr.bin/perl/t/opbasic/magic_phase.t
diff options
context:
space:
mode:
authorafresh1 <afresh1@openbsd.org>2014-03-24 14:58:42 +0000
committerafresh1 <afresh1@openbsd.org>2014-03-24 14:58:42 +0000
commit91f110e064cd7c194e59e019b83bb7496c1c84d4 (patch)
tree3e8e577405dba7e94b43cbf21c22f21aaa5ab949 /gnu/usr.bin/perl/t/opbasic/magic_phase.t
parentdo not call purge_task every 10 secs, it is only needed once at startup and (diff)
downloadwireguard-openbsd-91f110e064cd7c194e59e019b83bb7496c1c84d4.tar.xz
wireguard-openbsd-91f110e064cd7c194e59e019b83bb7496c1c84d4.zip
Import perl-5.18.2
OK espie@ sthen@ deraadt@
Diffstat (limited to 'gnu/usr.bin/perl/t/opbasic/magic_phase.t')
-rw-r--r--gnu/usr.bin/perl/t/opbasic/magic_phase.t49
1 files changed, 49 insertions, 0 deletions
diff --git a/gnu/usr.bin/perl/t/opbasic/magic_phase.t b/gnu/usr.bin/perl/t/opbasic/magic_phase.t
new file mode 100644
index 00000000000..d7217058575
--- /dev/null
+++ b/gnu/usr.bin/perl/t/opbasic/magic_phase.t
@@ -0,0 +1,49 @@
+#!./perl
+
+use strict;
+use warnings;
+
+# Test ${^GLOBAL_PHASE}
+#
+# Test::More, t/test.pl, etc., assert plans in END, which happens before global
+# destruction. We do not want to use those programs/libraries here, so we
+# place this file in directory t/opbasic.
+
+BEGIN { print "1..7\n" }
+
+sub ok ($$) {
+ print "not " if !$_[0];
+ print "ok";
+ print " - $_[1]" if defined $_[1];
+ print "\n";
+}
+
+BEGIN {
+ ok ${^GLOBAL_PHASE} eq 'START', 'START';
+}
+
+CHECK {
+ ok ${^GLOBAL_PHASE} eq 'CHECK', 'CHECK';
+}
+
+INIT {
+ ok ${^GLOBAL_PHASE} eq 'INIT', 'INIT';
+}
+
+ok ${^GLOBAL_PHASE} eq 'RUN', 'RUN';
+
+sub Moo::DESTROY {
+ ok ${^GLOBAL_PHASE} eq 'RUN', 'DESTROY is run-time too, usually';
+}
+
+my $tiger = bless {}, Moo::;
+
+sub Kooh::DESTROY {
+ ok ${^GLOBAL_PHASE} eq 'DESTRUCT', 'DESTRUCT';
+}
+
+our $affe = bless {}, Kooh::;
+
+END {
+ ok ${^GLOBAL_PHASE} eq 'END', 'END';
+}