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