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