Commit | Line | Data |
41888e7d |
1 | #!/usr/bin/perl |
c47cf415 |
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; |
41888e7d |
5 | |
6 | use strict; |
7 | use warnings; |
8 | |
c47cf415 |
9 | use Test::More; |
10 | $TODO = q{Mouse is not yet completed}; |
41888e7d |
11 | use Test::Exception; |
12 | |
13 | |
41888e7d |
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 | |
c47cf415 |
48 | use base 'Mouse::Meta::Class'; |
41888e7d |
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 | } |
c47cf415 |
60 | |
61 | done_testing; |