X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=blobdiff_plain;f=t%2F004_inheriting_class_meta_desc.t;h=3a3b6bf0292ea083c3c671e8a6b1623ce0d734a8;hb=56e78a9caff840fb68085ead8837a64c839740de;hp=ceff575486b686d5b6c0953a39ebb72fd9e01fc2;hpb=d9f5e5aeb1ca767b140e316900b53cfc4e87a09e;p=gitmo%2FMooseX-MetaDescription.git diff --git a/t/004_inheriting_class_meta_desc.t b/t/004_inheriting_class_meta_desc.t index ceff575..3a3b6bf 100644 --- a/t/004_inheriting_class_meta_desc.t +++ b/t/004_inheriting_class_meta_desc.t @@ -25,12 +25,23 @@ BEGIN { extends 'Foo'; + # always add it *after* the extends __PACKAGE__->meta->description->{'Hello'} = 'Earth'; package Baz; use Moose; extends 'Bar'; + + package Gorch; + use metaclass 'MooseX::MetaDescription::Meta::Class' => ( + description => { + 'Hello' => 'World' + } + ); + use Moose; + + extends 'Baz'; } # check the meta-desc @@ -50,6 +61,10 @@ isa_ok($baz_class, 'MooseX::MetaDescription::Meta::Class'); isa_ok($baz_class->metadescription, 'MooseX::MetaDescription::Description'); is($baz_class->metadescription->descriptor, $baz_class, '... got the circular ref'); +my $gorch_class = Gorch->meta; +isa_ok($gorch_class, 'MooseX::MetaDescription::Meta::Class'); +isa_ok($gorch_class->metadescription, 'MooseX::MetaDescription::Description'); +is($gorch_class->metadescription->descriptor, $gorch_class, '... got the circular ref'); foreach my $x ('Foo', Foo->new) { is_deeply( @@ -69,7 +84,7 @@ foreach my $x ('Bar', Bar->new) { 'Hello' => 'Earth', 'World' => 'Hello' }, - '... got the right class description' + '... got the right class description (inherited and changed)' ); } @@ -80,7 +95,16 @@ foreach my $x ('Baz', Baz->new) { 'Hello' => 'Earth', 'World' => 'Hello' }, - '... got the right class description' + '... got the right class description (inherited with changes handles correctly)' ); } +foreach my $x ('Gorch', Gorch->new) { + is_deeply( + $x->meta->description, + { + 'Hello' => 'World', + }, + '... got the right class description (with completely overriden desc)' + ); +}