X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=blobdiff_plain;f=t%2Fbasic.t;h=f69201fc803275db2655ba64e3726ad2f0dd8592;hb=43ee1f5b5267d15fe25b4292f7a49aed8359eca4;hp=1738d92725143eaa434735cf5f183d3059640207;hpb=23cfbce9adb92973d8dc954cb6486be73ed1845e;p=gitmo%2FMooseX-StrictConstructor.git diff --git a/t/basic.t b/t/basic.t index 1738d92..f69201f 100644 --- a/t/basic.t +++ b/t/basic.t @@ -44,6 +44,17 @@ use Test::More; } { + package OtherStrictSubclass; + + use Moose; + use MooseX::StrictConstructor; + + extends 'Standard'; + + has 'size' => ( is => 'rw' ); +} + +{ package Tricky; use Moose; @@ -69,7 +80,8 @@ use Test::More; has 'size' => ( is => 'rw', 'init_arg' => undef ); } -my @classes = qw( Standard Stricter Subclass StrictSubclass Tricky InitArg ); +my @classes + = qw( Standard Stricter Subclass StrictSubclass OtherStrictSubclass Tricky InitArg ); with_immutable { is( @@ -95,14 +107,27 @@ with_immutable { ); is( - exception { StrictSubclass->new( thing => 1, size => 'large', ) }, undef, - 'subclass that doesn\'t use strict constructor handles known attributes correctly' + exception { StrictSubclass->new( thing => 1, size => 'large', ) }, + undef, + q{subclass that doesn't use strict constructor handles known attributes correctly} ); like( exception { StrictSubclass->new( thing => 1, bad => 99 ) }, qr/unknown attribute.+: bad/, - 'subclass that doesn\'t use strict correctly recognizes bad attribute' + q{subclass that doesn't use strict correctly recognizes bad attribute} + ); + + is( + exception { OtherStrictSubclass->new( thing => 1, size => 'large', ) }, + undef, + q{strict subclass from parent that doesn't use strict constructor handles known attributes correctly} + ); + + like( + exception { OtherStrictSubclass->new( thing => 1, bad => 99 ) }, + qr/unknown attribute.+: bad/, + q{strict subclass from parent that doesn't use strict correctly recognizes bad attribute} ); is(