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