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