diff options
author | Jesse Luehrs <doy@tozt.net> | 2010-06-15 03:25:34 -0500 |
---|---|---|
committer | Jesse Luehrs <doy@tozt.net> | 2010-06-15 03:25:34 -0500 |
commit | eaf8ccad64a0ca7a5f69ce884753a395f4c196fc (patch) | |
tree | 04eed5d3df615c9d4151246f179e8fd86a1394c8 | |
parent | 6525ae7964dc9e5428008e0798ec4eebff5baa6d (diff) | |
download | moosex-nonmoose-eaf8ccad64a0ca7a5f69ce884753a395f4c196fc.tar.gz moosex-nonmoose-eaf8ccad64a0ca7a5f69ce884753a395f4c196fc.zip |
fix this test
-rw-r--r-- | t/50-buggy-constructor-inlining.t | 26 |
1 files changed, 9 insertions, 17 deletions
diff --git a/t/50-buggy-constructor-inlining.t b/t/50-buggy-constructor-inlining.t index c72c7c8..253ff03 100644 --- a/t/50-buggy-constructor-inlining.t +++ b/t/50-buggy-constructor-inlining.t @@ -2,8 +2,9 @@ use strict; use warnings; use Test::More tests => 6; +use Test::Moose qw(with_immutable); -my ($Foo, $Bar, $Baz) = (0, 0, 0); +my ($Foo, $Bar, $Baz); { package Foo; sub new { $Foo++; bless {}, shift } @@ -25,19 +26,10 @@ my ($Foo, $Bar, $Baz) = (0, 0, 0); sub BUILD { $Baz++ } } -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"); - -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"); +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'; |