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