summaryrefslogtreecommitdiffstats
path: root/t/buggy-constructor-inlining.t
diff options
context:
space:
mode:
authorJesse Luehrs <doy@tozt.net>2013-09-04 19:38:21 -0400
committerJesse Luehrs <doy@tozt.net>2013-09-04 19:47:11 -0400
commit8bf5e6931a1bd96df0cdb1ceb94bbb3e578a8126 (patch)
tree2e659a8f07ea1cca3091a9c0578bbd8e53c20c11 /t/buggy-constructor-inlining.t
parent8e0b4f219f2d8d94cb6937ef47168ac5fac03cd9 (diff)
downloadmoosex-nonmoose-8bf5e6931a1bd96df0cdb1ceb94bbb3e578a8126.tar.gz
moosex-nonmoose-8bf5e6931a1bd96df0cdb1ceb94bbb3e578a8126.zip
packaging
Diffstat (limited to 't/buggy-constructor-inlining.t')
-rw-r--r--t/buggy-constructor-inlining.t37
1 files changed, 37 insertions, 0 deletions
diff --git a/t/buggy-constructor-inlining.t b/t/buggy-constructor-inlining.t
new file mode 100644
index 0000000..bfb0689
--- /dev/null
+++ b/t/buggy-constructor-inlining.t
@@ -0,0 +1,37 @@
+#!/usr/bin/env perl
+use strict;
+use warnings;
+use Test::More;
+use Test::Moose;
+
+my ($Foo, $Bar, $Baz);
+{
+ package Foo;
+ sub new { $Foo++; bless {}, shift }
+}
+
+{
+ package Bar;
+ use Moose;
+ use MooseX::NonMoose;
+ extends 'Foo';
+ sub BUILD { $Bar++ }
+ __PACKAGE__->meta->make_immutable;
+}
+
+{
+ package Baz;
+ use Moose;
+ extends 'Bar';
+ sub BUILD { $Baz++ }
+}
+
+with_immutable {
+ ($Foo, $Bar, $Baz) = (0, 0, 0);
+ Baz->new;
+ is($Foo, 1, "Foo->new is called once");
+ is($Bar, 1, "Bar->BUILD is called once");
+ is($Baz, 1, "Baz->BUILD is called once");
+} 'Baz';
+
+done_testing;