Add another MOOSE_TEST_MD option, MooseX
[gitmo/Moose.git] / t / compat / moose_respects_base.t
CommitLineData
7eaef7ad 1#!/usr/bin/perl
2
3use strict;
4use warnings;
5
a28e50e4 6use Test::More;
7eaef7ad 7
7ff56534 8
bbd2fe69 9=pod
10
d03bd989 11This test demonstrates that Moose will respect
12a previously set @ISA using use base, and not
13try to add Moose::Object to it.
bbd2fe69 14
d03bd989 15However, this is extremely order sensitive as
bbd2fe69 16this 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
38my $bar = Bar->new;
39isa_ok($bar, 'Bar');
bbd2fe69 40isa_ok($bar, 'Foo');
41ok(!$bar->isa('Moose::Object'), '... Bar is not Moose::Object subclass');
42
43my $baz = Baz->new;
44isa_ok($baz, 'Baz');
45isa_ok($baz, 'Foo');
46isa_ok($baz, 'Moose::Object');
47
a28e50e4 48done_testing;