Commit | Line | Data |
31f8ec72 |
1 | #!/usr/bin/perl |
2 | |
3 | use strict; |
4 | use warnings; |
5 | |
07af02bd |
6 | use Test::More tests => 47; |
31f8ec72 |
7 | |
8 | BEGIN { |
9 | use_ok('Moose'); |
10 | } |
11 | |
12 | my @moose_exports = qw( |
13 | extends with |
14 | has |
15 | before after around |
3279ab4a |
16 | override |
17 | augment |
2a0f3bd3 |
18 | super inner |
5a3217de |
19 | make_immutable |
31f8ec72 |
20 | ); |
21 | |
22 | { |
23 | package Foo; |
24 | } |
25 | |
26 | eval q{ |
27 | package Foo; |
28 | use Moose; |
29 | }; |
30 | ok(!$@, '... Moose succesfully exported into Foo'); |
31 | |
32 | can_ok('Foo', $_) for @moose_exports; |
33 | |
34 | eval q{ |
35 | package Foo; |
36 | no Moose; |
37 | }; |
38 | ok(!$@, '... Moose succesfully un-exported from Foo'); |
39 | |
3279ab4a |
40 | ok(!Foo->can($_), '... Foo can no longer do ' . $_) for @moose_exports; |
3279ab4a |
41 | |
571dd39f |
42 | # and check the type constraints as well |
43 | |
44 | my @moose_type_constraint_exports = qw( |
45 | type subtype as where message |
46 | coerce from via |
47 | enum |
48 | find_type_constraint |
49 | ); |
50 | |
51 | { |
52 | package Bar; |
53 | } |
54 | |
55 | eval q{ |
56 | package Bar; |
57 | use Moose::Util::TypeConstraints; |
58 | }; |
59 | ok(!$@, '... Moose::Util::TypeConstraints succesfully exported into Bar'); |
60 | |
61 | can_ok('Bar', $_) for @moose_type_constraint_exports; |
62 | |
63 | eval q{ |
64 | package Bar; |
65 | no Moose::Util::TypeConstraints; |
66 | }; |
67 | ok(!$@, '... Moose::Util::TypeConstraints succesfully un-exported from Bar'); |
68 | |
69 | ok(!Bar->can($_), '... Bar can no longer do ' . $_) for @moose_type_constraint_exports; |
70 | |