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