Don't use $_ as loop variable when calling arbitrary code (RT#81072)
[gitmo/Moo.git] / t / has-array.t
CommitLineData
1d17c7c1 1use Test::More tests => 4;
2
3ok(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
11ok 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
20my $obj = new_ok 'Local::Test::Class1' => [
21 attr1 => 1,
22 attr2 => 2,
23 attr3 => 3,
24 attr4 => 4,
25];
26
27can_ok(
28 $obj,
29 qw( attr1 attr2 attr3 attr4 ),
30);