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