Commit | Line | Data |
7ecb13a6 |
1 | use strictures 1; |
2 | use Test::More; |
3 | |
4 | { |
5 | package Tower1; |
6 | |
7 | use Moo; |
8 | |
9 | has 'attr1' => (is => 'ro', required => 1); |
10 | |
11 | package Tower2; |
12 | |
13 | use Moose; |
14 | |
15 | extends 'Tower1'; |
16 | |
17 | has 'attr2' => (is => 'ro', required => 1); |
18 | |
19 | __PACKAGE__->meta->make_immutable; |
20 | |
21 | package Tower3; |
22 | |
23 | use Moo; |
24 | |
25 | extends 'Tower2'; |
26 | |
27 | has 'attr3' => (is => 'ro', required => 1); |
28 | |
29 | package Tower4; |
30 | |
31 | use Moose; |
32 | |
33 | extends 'Tower3'; |
34 | |
35 | has 'attr4' => (is => 'ro', required => 1); |
36 | |
37 | __PACKAGE__->meta->make_immutable; |
38 | } |
39 | |
40 | foreach my $num (1..4) { |
41 | my $class = "Tower${num}"; |
42 | my @attrs = map "attr$_", 1..$num; |
43 | my %args = map +($_ => "${_}_value"), @attrs; |
44 | my $obj = $class->new(%args); |
45 | is($obj->{$_}, "${_}_value", "Attribute $_ ok for $class") for @attrs; |
46 | } |
47 | |
48 | done_testing; |