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