3d2d91fa208ea5d3172ba2042fedd3a682af85e6
[gitmo/Moo.git] / t / has-array.t
1 use Test::More tests => 4;
2
3 ok(eval {
4   package Local::Test::Role1;
5   use Moo::Role;
6   has [qw/ attr1 attr2 /] => (is => 'ro');
7   1;
8 }, 'has \@attrs works in roles')
9   or diag "EVAL FAILED: $@";
10
11 ok eval {
12   package Local::Test::Class1;
13   use Moo;
14   with 'Local::Test::Role1';
15   has [qw/ attr3 attr4 /] => (is => 'ro');
16   1;
17 }, 'has \@attrs works in classes'
18   or diag "EVAL FAILED: $@";
19
20 my $obj = new_ok 'Local::Test::Class1' => [
21   attr1  => 1,
22   attr2  => 2,
23   attr3  => 3,
24   attr4  => 4,
25 ];
26
27 can_ok(
28   $obj,
29   qw( attr1 attr2 attr3 attr4 ),
30 );