From: Stevan Little Date: Tue, 11 Mar 2008 16:33:42 +0000 (+0000) Subject: fixing sartaks test X-Git-Tag: 0_55~289 X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=61c0fc9f6c33d4258de91f0b6b95c84491cbda72;p=gitmo%2FMoose.git fixing sartaks test --- diff --git a/t/300_immutable/006_immutable_nonmoose_subclass.t b/t/300_immutable/006_immutable_nonmoose_subclass.t index 5445a9e..29143f3 100644 --- a/t/300_immutable/006_immutable_nonmoose_subclass.t +++ b/t/300_immutable/006_immutable_nonmoose_subclass.t @@ -12,6 +12,35 @@ BEGIN { use_ok('Moose::Meta::Role'); } +=pod + +This test it kind of odd, it tests +to see if make_immutable will DWIM +when pressented with a class that +inherits from a non-Moose base class. + +Since immutable only affects the local +class, and if it doesnt find a constructor +it will always create one, it won't +discover this issue, and it will ignore +the inherited constructor. + +This is not really the desired way, but +detecting this opens a big can of worms +which we are not going to deal with just +yet (eventually yes, but most likely it +will be when we have MooseX::Compile +available and working). + +In the meantime, just know that when you +call make_immutable on a class which +inherits from a non-Moose class, you +should add (inline_constructor => 0). + +Sorry Sartak. + +=cut + { package Grandparent; @@ -64,6 +93,7 @@ is(Child->new->grandparent, 1, "Child responds to grandparent"); is(Child->new->parent, 1, "Child responds to parent"); is(Child->new->child, 1, "Child responds to child"); -is(Child->new->{grandparent}, 'gramma', "Instance structure has attributes"); -is(Child->new->{parent}, 'mama', "Parent's 'around' is respected"); +is(Child->new->{grandparent}, undef, "didnt create a value, cause immutable overode the constructor"); +is(Child->new->{parent}, undef, "didnt create a value, cause immutable overode the constructor"); +