X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?p=gitmo%2FMouse.git;a=blobdiff_plain;f=t%2F010_basics%2F020-global-destruction.t;fp=t%2F010_basics%2F020-global-destruction.t;h=7bcecf0e6d0ac1d08e6cab031d5788e9481ce356;hp=0000000000000000000000000000000000000000;hb=6475f69defb20a02b6559bddf870a0821f28ac20;hpb=6d5a627396f91b2dce25a7b6e5c5dbe6b67f2d95 diff --git a/t/010_basics/020-global-destruction.t b/t/010_basics/020-global-destruction.t new file mode 100644 index 0000000..7bcecf0 --- /dev/null +++ b/t/010_basics/020-global-destruction.t @@ -0,0 +1,51 @@ +#!/usr/bin/perl + +use strict; +use warnings; + +use Test::More; + +{ + package Foo; + use Mouse; + + sub DEMOLISH { + my $self = shift; + my ($igd) = @_; + ::ok( + !$igd, + 'in_global_destruction state is passed to DEMOLISH properly (false)' + ); + } +} + +{ + my $foo = Foo->new; +} + +{ + package Bar; + use Mouse; + + sub DEMOLISH { + my $self = shift; + my ($igd) = @_; + ::ok( + !$igd, + 'in_global_destruction state is passed to DEMOLISH properly (false)' + ); + } + + __PACKAGE__->meta->make_immutable; +} + +{ + my $bar = Bar->new; +} + +ok( + $_, + 'in_global_destruction state is passed to DEMOLISH properly (true)' +) for split //, `$^X t/010_basics/020-global-destruction-helper.pl`; + +done_testing;