All these evals do is hide when Moose or some other module has a syntax error.
[gitmo/Moose.git] / t / 010_basics / 009_import_unimport.t
1 #!/usr/bin/perl
2
3 use strict;
4 use warnings;
5
6 use Test::More tests => 46;
7
8
9 my @moose_exports = qw(
10     extends with 
11     has 
12     before after around
13     override
14     augment
15     super inner
16     make_immutable
17 );
18
19 {
20     package Foo;
21
22     use Moose;
23 }
24
25 can_ok('Foo', $_) for @moose_exports;
26
27 {
28     package Foo;
29     no Moose;
30 }
31
32 ok(!Foo->can($_), '... Foo can no longer do ' . $_) for @moose_exports;
33
34 # and check the type constraints as well
35
36 my @moose_type_constraint_exports = qw(
37     type subtype as where message 
38     coerce from via 
39     enum
40     find_type_constraint
41 );
42
43 {
44     package Bar;
45
46     use Moose::Util::TypeConstraints;
47 }
48
49 can_ok('Bar', $_) for @moose_type_constraint_exports;
50
51 {
52     package Bar;
53     no Moose::Util::TypeConstraints;
54 }
55
56 ok(!Bar->can($_), '... Bar can no longer do ' . $_) for @moose_type_constraint_exports;
57