Commit | Line | Data |
---|---|---|
8fa582b1 | 1 | #!/usr/bin/perl |
31f8ec72 | 2 | |
3 | use strict; | |
4 | use warnings; | |
5 | ||
a28e50e4 | 6 | use Test::More; |
7ff56534 | 7 | |
31f8ec72 | 8 | |
31f8ec72 | 9 | my @moose_exports = qw( |
d03bd989 | 10 | extends with |
11 | has | |
31f8ec72 | 12 | before after around |
3279ab4a | 13 | override |
14 | augment | |
2a0f3bd3 | 15 | super inner |
e0d3eb10 | 16 | blessed confess |
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( | |
d03bd989 | 40 | type subtype as where message |
41 | coerce from via | |
571dd39f | 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 | ||
e05fb8ae | 64 | |
65 | { | |
66 | package Baz; | |
67 | ||
e05fb8ae | 68 | use Moose; |
e0d3eb10 | 69 | use Scalar::Util qw( blessed ); |
e05fb8ae | 70 | |
71 | no Moose; | |
72 | } | |
73 | ||
74 | can_ok( 'Baz', 'blessed' ); | |
a28e50e4 | 75 | |
d004fa18 | 76 | { |
77 | package Moo; | |
78 | ||
79 | use Scalar::Util qw( blessed ); | |
80 | use Moose; | |
81 | ||
82 | no Moose; | |
83 | } | |
84 | ||
85 | can_ok( 'Moo', 'blessed' ); | |
86 | ||
87 | my $blessed; | |
88 | { | |
89 | package Quux; | |
90 | ||
91 | use Scalar::Util qw( blessed ); | |
92 | use Moose blessed => { -as => \$blessed }; | |
93 | ||
94 | no Moose; | |
95 | } | |
96 | ||
97 | can_ok( 'Quux', 'blessed' ); | |
98 | is( $blessed, \&Scalar::Util::blessed ); | |
99 | ||
a28e50e4 | 100 | done_testing; |