test for global destruction bug
Graham Knop [Thu, 1 Aug 2013 15:53:15 +0000 (11:53 -0400)]
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.

xt/global-destruct-jenga-helper.pl [new file with mode: 0644]
xt/global-destruct-jenga.t [new file with mode: 0644]

diff --git a/xt/global-destruct-jenga-helper.pl b/xt/global-destruct-jenga-helper.pl
new file mode 100644 (file)
index 0000000..5ba4a24
--- /dev/null
@@ -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 (file)
index 0000000..3954f9d
--- /dev/null
@@ -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;