2 # This is automatically generated by author/import-moose-test.pl.
3 # DO NOT EDIT THIS FILE. ANY CHANGES WILL BE LOST!!!
4 use t::lib::MooseCompat;
20 clearer => 'clear_bar',
30 ::lives_ok { has '+foo' => (is => 'rw') } "can override is";
31 ::throws_ok { has '+foo' => (reader => 'bar') } qr/illegal/, "can't override reader";
32 ::lives_ok { has '+foo' => (clearer => 'baz') } "can override unspecified things";
34 ::throws_ok { has '+bar' => (clearer => 'quux') } qr/illegal/, "can't override clearer";
35 ::lives_ok { has '+bar' => (predicate => 'has_bar') } "can override unspecified things";
39 package Bar::Meta::Attribute;
42 has my_illegal_option => (is => 'ro');
44 around illegal_options_for_inheritance => sub {
45 return (shift->(@_), 'my_illegal_option');
55 traits => ['Bar::Meta::Attribute'],
56 my_illegal_option => 'FOO',
59 } "can use illegal options";
62 traits => ['Bar::Meta::Attribute'],
73 ::throws_ok { has '+bar' => (my_illegal_option => 'BAR') }
75 "can't override illegal attribute";
76 ::lives_ok { has '+baz' => (my_illegal_option => 'BAR') }
77 "can add illegal option if superclass doesn't set it";
80 my $bar_attr = Bar->meta->get_attribute('bar');
81 ok((grep { $_ eq 'my_illegal_option' } $bar_attr->illegal_options_for_inheritance) > 0, '... added my_illegal_option as illegal option for inheritance');