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