6 use Test::More 'no_plan';
10 use_ok('MooseX::MetaDescription');
18 metaclass => 'MooseX::MetaDescription::Meta::Attribute',
21 default => sub { 'Foo::bar' },
23 baz => 'Foo::bar::baz',
24 gorch => 'Foo::bar::gorch',
29 traits => [ 'MooseX::MetaDescription::Meta::Trait' ],
32 default => sub { 'Foo::baz' },
34 bar => 'Foo::baz::bar',
35 gorch => 'Foo::baz::gorch',
47 my $bar_attr = Foo->meta->find_attribute_by_name('bar');
48 isa_ok($bar_attr->metadescription, 'MooseX::MetaDescription::Description');
49 is($bar_attr->metadescription->descriptor, $bar_attr, '... got the circular ref');
51 my $baz_attr = Foo->meta->find_attribute_by_name('baz');
52 isa_ok($baz_attr->metadescription, 'MooseX::MetaDescription::Description');
53 is($baz_attr->metadescription->descriptor, $baz_attr, '... got the circular ref');
57 my $bar_attr = Bar->meta->find_attribute_by_name('bar');
59 can_ok($bar_attr, 'description');
60 isa_ok($bar_attr->metadescription, 'MooseX::MetaDescription::Description');
61 is($bar_attr->metadescription->descriptor, $bar_attr, '... got the circular ref');
63 my $baz_attr = Bar->meta->find_attribute_by_name('baz');
65 can_ok($baz_attr, 'description');
66 isa_ok($baz_attr->metadescription, 'MooseX::MetaDescription::Description');
67 is($baz_attr->metadescription->descriptor, $baz_attr, '... got the circular ref');
69 my ($bar_attr_2, $baz_attr_2) = sort { $a->name cmp $b->name } Bar->meta->get_all_attributes;
70 is($bar_attr, $bar_attr_2, '... got the same attribute');
71 is($baz_attr, $baz_attr_2, '... got the same attribute');
74 # check the actual descs
76 foreach my $foo ('Foo', Foo->new, 'Bar', Bar->new) {
79 $foo->meta->find_attribute_by_name('bar')->description,
81 baz => 'Foo::bar::baz',
82 gorch => 'Foo::bar::gorch',
84 '... got the right class description'
88 $foo->meta->find_attribute_by_name('baz')->description,
90 bar => 'Foo::baz::bar',
91 gorch => 'Foo::baz::gorch',
93 '... got the right class description'