4 use Test::More tests => 12;
11 has attr => ( is => 'rw', isa => 'Str' );
19 has '+attr' => ( lazy_build => 1 );
28 my $parent = Parent->new();
29 my $child = Child->new();
31 ok(!$parent->meta->get_attribute('attr')->is_lazy_build,
32 'attribute in parent does not have lazy_build trait');
33 ok(!$parent->meta->get_attribute('attr')->is_lazy,
34 'attribute in parent does not have lazy trait');
35 ok(!$parent->meta->get_attribute('attr')->has_builder,
36 'attribute in parent does not have a builder method');
37 ok(!$parent->meta->get_attribute('attr')->has_clearer,
38 'attribute in parent does not have a clearer method');
39 ok(!$parent->meta->get_attribute('attr')->has_predicate,
40 'attribute in parent does not have a predicate method');
42 ok($child->meta->get_attribute('attr')->is_lazy_build,
43 'attribute in child has the lazy_build trait');
44 ok($child->meta->get_attribute('attr')->is_lazy,
45 'attribute in child has the lazy trait');
46 ok($child->meta->get_attribute('attr')->has_builder,
47 'attribute in child has a builder method');
48 ok($child->meta->get_attribute('attr')->has_clearer,
49 'attribute in child has a clearer method');
50 ok($child->meta->get_attribute('attr')->has_predicate,
51 'attribute in child has a predicate method');
53 is($child->attr, 'value', 'attribute defined as lazy_build in child is properly built');