X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=blobdiff_plain;f=t%2Finherited.t;h=a2e156799d2781159390714f49a046046465686f;hb=755dd065feaf53aa8c20fff75612b6816106a17a;hp=80ef240700cfa84e1604e1e3837a05ce33b0213a;hpb=9c3d517999ac5ebe07b701bfa96a7d42f40e9201;p=p5sagit%2FClass-Accessor-Grouped.git diff --git a/t/inherited.t b/t/inherited.t index 80ef240..a2e1567 100644 --- a/t/inherited.t +++ b/t/inherited.t @@ -1,4 +1,5 @@ -use Test::More tests => 35; +use Test::More tests => 36; +use Test::Exception; use strict; use warnings; use lib 't/lib'; @@ -57,15 +58,13 @@ is(BaseInheritedGroups->basefield, 'All Your Base'); # croak on get/set on non hash-based object my $dying = NotHashBased->new; -eval { - $dying->killme; -}; -ok($@ =~ /Cannot get.*is not hash-based/); +throws_ok { + $dying->killme; +} qr/Cannot get.*is not hash-based/; -eval { - $dying->killme('foo'); -}; -ok($@ =~ /Cannot set.*is not hash-based/); +throws_ok { + $dying->killme('foo'); +} qr/Cannot set.*is not hash-based/; # make sure we're get defined items, even 0, '' BaseInheritedGroups->basefield('base'); @@ -81,3 +80,14 @@ SuperInheritedGroups->basefield(undef); is(SuperInheritedGroups->basefield, 'base'); is(BaseInheritedGroups->undefined, undef); + +# make sure run-time @ISA changes trigger an inheritance chain recalculation +SuperInheritedGroups->basefield(undef); +BaseInheritedGroups->basefield('your base'); + +# dirty hack, emulate Class::C3::Componentised +require ExtraInheritedGroups; +unshift @SuperInheritedGroups::ISA, qw/ExtraInheritedGroups/; + +# this comes from ExtraInheritedGroups +is(SuperInheritedGroups->basefield, 'your extra base!');