From: Graham Knop Date: Thu, 1 Aug 2013 15:53:15 +0000 (-0400) Subject: test for global destruction bug X-Git-Tag: v1.003001~18 X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=c944f84cc09cd1f9e644e8a08e62c27412dbe892;p=gitmo%2FMoo.git test for global destruction bug Objects formed from certain Moo+Moose combinations will explode in global destruction if they are kept alive by being stored in a package variable or closed over by a sub. --- diff --git a/xt/global-destruct-jenga-helper.pl b/xt/global-destruct-jenga-helper.pl new file mode 100644 index 0000000..5ba4a24 --- /dev/null +++ b/xt/global-destruct-jenga-helper.pl @@ -0,0 +1,18 @@ +use strictures; +use lib 'lib'; +{ + package BaseClass; + use Moo; +} +{ + package Subclass; + use Moose; + extends 'BaseClass'; + __PACKAGE__->meta->make_immutable; +} +{ + package Blorp; + use Moo; + extends 'Subclass'; +} +our $o = Blorp->new; diff --git a/xt/global-destruct-jenga.t b/xt/global-destruct-jenga.t new file mode 100644 index 0000000..3954f9d --- /dev/null +++ b/xt/global-destruct-jenga.t @@ -0,0 +1,7 @@ +use strictures 1; +use Test::More; + +my $out = `$^X xt/global-destruct-jenga-helper.pl 2>&1`; +is $out, '', 'no errors from global destruct of jenga object'; + +done_testing;