version bump
[gitmo/Moose.git] / t / metaclasses / moose_w_metaclass.t
CommitLineData
7eaef7ad 1#!/usr/bin/perl
2
3use strict;
4use warnings;
5
a28e50e4 6use Test::More;
7eaef7ad 7
7ff56534 8
bbd2fe69 9=pod
10
d03bd989 11This test demonstrates that Moose will respect
12a metaclass previously set with the metaclass
13pragma.
bbd2fe69 14
d03bd989 15It also checks an error condition where that
bbd2fe69 16metaclass must be a Moose::Meta::Class subclass
17in order to work.
18
19=cut
20
7eaef7ad 21
22{
23 package Foo::Meta;
24 use strict;
25 use warnings;
26
27 use base 'Moose::Meta::Class';
d03bd989 28
7eaef7ad 29 package Foo;
30 use strict;
31 use warnings;
32 use metaclass 'Foo::Meta';
33 ::use_ok('Moose');
34}
35
36isa_ok(Foo->meta, 'Foo::Meta');
37
38{
39 package Bar::Meta;
40 use strict;
41 use warnings;
d03bd989 42
7eaef7ad 43 use base 'Class::MOP::Class';
d03bd989 44
7eaef7ad 45 package Bar;
46 use strict;
47 use warnings;
48 use metaclass 'Bar::Meta';
49 eval 'use Moose;';
50 ::ok($@, '... could not load moose without correct metaclass');
d03bd989 51 ::like($@,
50d5df60 52 qr/^Bar already has a metaclass, but it does not inherit Moose::Meta::Class/,
66bcefc1 53 '... got the right error too');
7eaef7ad 54}
a28e50e4 55
56done_testing;