Changelogging
[gitmo/Mouse.git] / t-failing / 050_metaclasses / 003_moose_w_metaclass.t
1 #!/usr/bin/perl
2 # This is automatically generated by author/import-moose-test.pl.
3 # DO NOT EDIT THIS FILE. ANY CHANGES WILL BE LOST!!!
4 use t::lib::MooseCompat;
5
6 use strict;
7 use warnings;
8
9 use Test::More;
10 $TODO = q{Mouse is not yet completed};
11 use Test::Exception;
12
13
14 =pod
15
16 This test demonstrates that Mouse will respect
17 a metaclass previously set with the metaclass
18 pragma.
19
20 It also checks an error condition where that
21 metaclass must be a Mouse::Meta::Class subclass
22 in order to work.
23
24 =cut
25
26
27 {
28     package Foo::Meta;
29     use strict;
30     use warnings;
31
32     use base 'Mouse::Meta::Class';
33
34     package Foo;
35     use strict;
36     use warnings;
37     use metaclass 'Foo::Meta';
38     ::use_ok('Mouse');
39 }
40
41 isa_ok(Foo->meta, 'Foo::Meta');
42
43 {
44     package Bar::Meta;
45     use strict;
46     use warnings;
47
48     use base 'Mouse::Meta::Class';
49
50     package Bar;
51     use strict;
52     use warnings;
53     use metaclass 'Bar::Meta';
54     eval 'use Mouse;';
55     ::ok($@, '... could not load moose without correct metaclass');
56     ::like($@,
57         qr/^Bar already has a metaclass, but it does not inherit Mouse::Meta::Class/,
58         '... got the right error too');
59 }
60
61 done_testing;