6 package Local::Test::Role1;
8 has [qw/ attr1 attr2 /] => (is => 'ro');
9 }, undef, 'has \@attrs works in roles');
12 package Local::Test::Class1;
14 with 'Local::Test::Role1';
15 has [qw/ attr3 attr4 /] => (is => 'ro');
16 }, undef, 'has \@attrs works in classes');
18 my $obj = new_ok 'Local::Test::Class1' => [
27 qw( attr1 attr2 attr3 attr4 ),
31 package Local::Test::Role2;
33 has [qw/ attr1 attr2 /] => (is => 'ro', 'isa');
34 }, qr/^Invalid options for 'attr1', 'attr2' attribute\(s\): even number of arguments expected, got 3/,
35 'correct exception when has given bad parameters in role');
38 package Local::Test::Class2;
40 has [qw/ attr3 attr4 /] => (is => 'ro', 'isa');
41 }, qr/^Invalid options for 'attr3', 'attr4' attribute\(s\): even number of arguments expected, got 3/,
42 'correct exception when has given bad parameters in class');