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