Include method name in immutable methods (fixes #49680)
[gitmo/Class-MOP.git] / t / 042_metaclass_incompatibility_dyn.t
1 use strict;
2 use warnings;
3
4 use Test::More tests => 6;
5
6 BEGIN {use metaclass;    
7 }
8
9 # meta classes
10 {
11     package Foo::Meta;
12     use base 'Class::MOP::Class';
13     
14     package Bar::Meta;
15     use base 'Class::MOP::Class';
16     
17     package FooBar::Meta;
18     use base 'Foo::Meta', 'Bar::Meta';
19 }
20
21 $@ = undef;
22 eval {
23     package Foo;
24     metaclass->import('Foo::Meta');
25 };
26 ok(!$@, '... Foo.meta => Foo::Meta is compatible') || diag $@;
27
28 $@ = undef;
29 eval {
30     package Bar;
31     metaclass->import('Bar::Meta');
32 };
33 ok(!$@, '... Bar.meta => Bar::Meta is compatible') || diag $@;
34
35 $@ = undef;
36 eval {
37     package Foo::Foo;
38     metaclass->import('Bar::Meta');
39     Foo::Foo->meta->superclasses('Foo');    
40 };
41 ok($@, '... Foo::Foo.meta => Bar::Meta is not compatible') || diag $@;
42
43 $@ = undef;
44 eval {
45     package Bar::Bar;
46     metaclass->import('Foo::Meta');
47     Bar::Bar->meta->superclasses('Bar');
48 };
49 ok($@, '... Bar::Bar.meta => Foo::Meta is not compatible') || diag $@;
50
51 $@ = undef;
52 eval {
53     package FooBar;
54     metaclass->import('FooBar::Meta');
55     FooBar->meta->superclasses('Foo');    
56 };
57 ok(!$@, '... FooBar.meta => FooBar::Meta is compatible') || diag $@;
58
59 $@ = undef;
60 eval {
61     package FooBar2;
62     metaclass->import('FooBar::Meta');
63     FooBar2->meta->superclasses('Bar');    
64 };
65 ok(!$@, '... FooBar2.meta => FooBar::Meta is compatible') || diag $@;
66
67