4 use Test::More tests => 11;
25 my $obj = Child->new(class => 1, child => 1);
26 ok($obj->child, "local attribute set in constructor");
27 ok($obj->class, "inherited attribute set in constructor");
29 is_deeply([sort(Child->meta->get_all_attributes)], [sort(
30 Child->meta->get_attribute('child'),
31 Class->meta->get_attribute('class'),
32 )], "correct get_all_attributes");
53 is($foo->attr, 'Foo', 'subclass does not affect parent attr');
56 is($bar->attr, undef, 'new attribute does not have the new default');
58 is(Foo->meta->get_attribute('attr')->default, 'Foo');
59 is(Foo->meta->get_attribute('attr')->_is_metadata, 'ro');
61 is(Bar->meta->get_attribute('attr')->default, undef);
62 is(Bar->meta->get_attribute('attr')->_is_metadata, 'rw');
64 is_deeply([Foo->meta->get_all_attributes], [
65 Foo->meta->get_attribute('attr'),
66 ], "correct get_all_attributes");
68 is_deeply([Bar->meta->get_all_attributes], [
69 Bar->meta->get_attribute('attr'),
70 ], "correct get_all_attributes");