Commit | Line | Data |
---|---|---|
9a7f2b2d | 1 | #!/usr/bin/perl |
2 | ||
3 | use strict; | |
4 | use warnings; | |
5 | ||
a28e50e4 | 6 | use Test::More; |
9a7f2b2d | 7 | |
61c4a4cd | 8 | { |
9 | package Foo; | |
10 | use Moose; | |
9a7f2b2d | 11 | |
61c4a4cd | 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 | } | |
9a7f2b2d | 20 | } |
21 | ||
9a7f2b2d | 22 | { |
23 | my $foo = Foo->new; | |
24 | } | |
61c4a4cd | 25 | |
b288593e | 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)' | |
829433c4 | 49 | ) for split //, `$^X t/basics/global-destruction-helper.pl`; |
b288593e | 50 | |
a28e50e4 | 51 | done_testing; |