no, actually, we do require this to work/:
[gitmo/Moose.git] / t / 060_compat / 002_moose_respects_base.t
1 #!/usr/bin/perl
2
3 use strict;
4 use warnings;
5
6 use Test::More;
7 use Test::Exception;
8
9
10 =pod
11
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.
15
16 However, this is extremely order sensitive as
17 this test also demonstrates.
18
19 =cut
20
21 {
22     package Foo;
23     use strict;
24     use warnings;
25
26     sub foo { 'Foo::foo' }
27
28     package Bar;
29     use base 'Foo';
30     use Moose;
31
32     sub new { (shift)->meta->new_object(@_) }
33
34     package Baz;
35     use Moose;
36     use base 'Foo';
37 }
38
39 my $bar = Bar->new;
40 isa_ok($bar, 'Bar');
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
49 done_testing;