Commit | Line | Data |
da4b56da |
1 | use strictures; |
2 | use Test::More; |
3 | use Test::Fatal; |
1d17c7c1 |
4 | |
da4b56da |
5 | is(exception { |
1d17c7c1 |
6 | package Local::Test::Role1; |
7 | use Moo::Role; |
8 | has [qw/ attr1 attr2 /] => (is => 'ro'); |
da4b56da |
9 | }, undef, 'has \@attrs works in roles'); |
1d17c7c1 |
10 | |
da4b56da |
11 | is(exception { |
1d17c7c1 |
12 | package Local::Test::Class1; |
13 | use Moo; |
14 | with 'Local::Test::Role1'; |
15 | has [qw/ attr3 attr4 /] => (is => 'ro'); |
da4b56da |
16 | }, undef, 'has \@attrs works in classes'); |
1d17c7c1 |
17 | |
18 | my $obj = new_ok 'Local::Test::Class1' => [ |
19 | attr1 => 1, |
20 | attr2 => 2, |
21 | attr3 => 3, |
22 | attr4 => 4, |
23 | ]; |
24 | |
25 | can_ok( |
26 | $obj, |
27 | qw( attr1 attr2 attr3 attr4 ), |
28 | ); |
da4b56da |
29 | |
30 | done_testing; |