Commit | Line | Data |
---|---|---|
7eaef7ad | 1 | #!/usr/bin/perl |
2 | ||
3 | use strict; | |
4 | use warnings; | |
5 | ||
a28e50e4 | 6 | use Test::More; |
7eaef7ad | 7 | |
7ff56534 | 8 | |
bbd2fe69 | 9 | =pod |
10 | ||
d03bd989 | 11 | This test demonstrates that Moose will respect |
12 | a previously set @ISA using use base, and not | |
13 | try to add Moose::Object to it. | |
bbd2fe69 | 14 | |
d03bd989 | 15 | However, this is extremely order sensitive as |
bbd2fe69 | 16 | this test also demonstrates. |
17 | ||
18 | =cut | |
19 | ||
7eaef7ad | 20 | { |
21 | package Foo; | |
22 | use strict; | |
23 | use warnings; | |
d03bd989 | 24 | |
7eaef7ad | 25 | sub foo { 'Foo::foo' } |
d03bd989 | 26 | |
27 | package Bar; | |
7eaef7ad | 28 | use base 'Foo'; |
bbd2fe69 | 29 | use Moose; |
d03bd989 | 30 | |
31 | sub new { (shift)->meta->new_object(@_) } | |
32 | ||
bbd2fe69 | 33 | package Baz; |
d03bd989 | 34 | use Moose; |
35 | use base 'Foo'; | |
7eaef7ad | 36 | } |
37 | ||
38 | my $bar = Bar->new; | |
39 | isa_ok($bar, 'Bar'); | |
bbd2fe69 | 40 | isa_ok($bar, 'Foo'); |
41 | ok(!$bar->isa('Moose::Object'), '... Bar is not Moose::Object subclass'); | |
42 | ||
43 | my $baz = Baz->new; | |
44 | isa_ok($baz, 'Baz'); | |
45 | isa_ok($baz, 'Foo'); | |
46 | isa_ok($baz, 'Moose::Object'); | |
47 | ||
a28e50e4 | 48 | done_testing; |