Add another MOOSE_TEST_MD option, MooseX
[gitmo/Moose.git] / t / basics / global_destruction.t
1 #!/usr/bin/perl
2
3 use strict;
4 use warnings;
5
6 use Test::More;
7
8 {
9     package Foo;
10     use Moose;
11
12     sub DEMOLISH {
13         my $self = shift;
14         my ($igd) = @_;
15         ::ok(
16             !$igd,
17             'in_global_destruction state is passed to DEMOLISH properly (false)'
18         );
19     }
20 }
21
22 {
23     my $foo = Foo->new;
24 }
25
26 {
27     package Bar;
28     use Moose;
29
30     sub DEMOLISH {
31         my $self = shift;
32         my ($igd) = @_;
33         ::ok(
34             !$igd,
35             'in_global_destruction state is passed to DEMOLISH properly (false)'
36         );
37     }
38
39     __PACKAGE__->meta->make_immutable;
40 }
41
42 {
43     my $bar = Bar->new;
44 }
45
46 ok(
47     $_,
48     'in_global_destruction state is passed to DEMOLISH properly (true)'
49 ) for split //, `$^X t/basics/global-destruction-helper.pl`;
50
51 done_testing;