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