From eaf8ccad64a0ca7a5f69ce884753a395f4c196fc Mon Sep 17 00:00:00 2001 From: Jesse Luehrs Date: Tue, 15 Jun 2010 03:25:34 -0500 Subject: fix this test --- t/50-buggy-constructor-inlining.t | 26 +++++++++----------------- 1 file changed, 9 insertions(+), 17 deletions(-) (limited to 't') 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'; -- cgit v1.2.3