6 use Test::More no_plan => 1;
10 use_ok('Class::MOP::SafeMixin');
13 ## Mixin a class without a superclass.
17 sub foo { 'FooMixin::foo' }
20 use metaclass 'Class::MOP::SafeMixin';
21 Foo->meta->mixin('FooMixin');
22 sub new { (shift)->meta->new_object(@_) }
29 is($foo->foo, 'FooMixin::foo', '... got the right value from the mixin method');
31 ## Mixin a class who shares a common ancestor
35 sub baz { 'Baz::baz' }
41 our @ISA = ('Foo', 'Bar');
43 package Foo::Bar::Baz;
44 our @ISA = ('Foo::Bar');
45 eval { Foo::Bar::Baz->meta->mixin('Baz') };
46 ::ok(!$@, '... the classes superclass must extend a subclass of the superclass of the mixins');
49 my $foo_bar_baz = Foo::Bar::Baz->new();
50 isa_ok($foo_bar_baz, 'Foo::Bar::Baz');
51 isa_ok($foo_bar_baz, 'Foo::Bar');
52 isa_ok($foo_bar_baz, 'Foo');
53 isa_ok($foo_bar_baz, 'Bar');
55 can_ok($foo_bar_baz, 'baz');
56 is($foo_bar_baz->baz(), 'Baz::baz', '... got the right value from the mixin method');