summaryrefslogtreecommitdiffstats
path: root/t
diff options
context:
space:
mode:
authorJesse Luehrs <doy@tozt.net>2010-02-09 14:58:42 -0600
committerJesse Luehrs <doy@tozt.net>2010-02-09 15:03:04 -0600
commit354a705b92727013a0fc0be23290f50000ea2809 (patch)
tree50f11803ad9a12956b15b310bfc14702cb02f9f9 /t
parentacdedee554adae843f992406326ce2e3bb74d6c6 (diff)
downloadmoosex-nonmoose-354a705b92727013a0fc0be23290f50000ea2809.tar.gz
moosex-nonmoose-354a705b92727013a0fc0be23290f50000ea2809.zip
add TODO test for inlined constructors
Diffstat (limited to 't')
-rw-r--r--t/100-buggy-constructor-inlining.t45
1 files changed, 45 insertions, 0 deletions
diff --git a/t/100-buggy-constructor-inlining.t b/t/100-buggy-constructor-inlining.t
new file mode 100644
index 0000000..591fae0
--- /dev/null
+++ b/t/100-buggy-constructor-inlining.t
@@ -0,0 +1,45 @@
+#!/usr/bin/env perl
+use strict;
+use warnings;
+use Test::More tests => 6;
+
+my ($Foo, $Bar, $Baz) = (0, 0, 0);
+{
+ 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++ }
+}
+
+Baz->new;
+{ local $TODO = "need to call custom constructor for other classes, not Moose::Object->new";
+is($Foo, 1, "Foo->new is called");
+}
+{ local $TODO = "need to call non-Moose constructor, not superclass constructor";
+is($Bar, 0, "Bar->new is not called");
+}
+is($Baz, 1, "Baz->new is called");
+
+Baz->meta->make_immutable;
+($Foo, $Bar, $Baz) = (0, 0, 0);
+
+Baz->new;
+is($Foo, 1, "Foo->new is called");
+{ local $TODO = "need to call non-Moose constructor, not superclass constructor";
+is($Bar, 0, "Bar->new is not called");
+}
+is($Baz, 1, "Baz->new is called");