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