Commit | Line | Data |
bc1e29b5 |
1 | #!/usr/bin/perl |
2 | |
3 | use strict; |
4 | use warnings; |
5 | |
a28e50e4 |
6 | use Test::More; |
b10dde3a |
7 | use Test::Fatal; |
bc1e29b5 |
8 | |
7ff56534 |
9 | |
bc1e29b5 |
10 | { |
11 | package Foo; |
12 | use Moose; |
05d9eaf6 |
13 | use Moose::Util::TypeConstraints; |
bc1e29b5 |
14 | } |
15 | |
16 | can_ok('Foo', 'meta'); |
17 | isa_ok(Foo->meta, 'Moose::Meta::Class'); |
18 | |
e522431d |
19 | ok(Foo->meta->has_method('meta'), '... we got the &meta method'); |
bc1e29b5 |
20 | ok(Foo->isa('Moose::Object'), '... Foo is automagically a Moose::Object'); |
21 | |
b10dde3a |
22 | isnt( exception { |
d03bd989 |
23 | Foo->meta->has_method() |
b10dde3a |
24 | }, undef, '... has_method requires an arg' ); |
bbd2fe69 |
25 | |
ef333f17 |
26 | can_ok('Foo', 'does'); |
27 | |
bc1e29b5 |
28 | foreach my $function (qw( |
f4fce6c8 |
29 | extends |
30 | has |
31 | before after around |
32 | blessed confess |
33 | type subtype as where |
34 | coerce from via |
35 | find_type_constraint |
36 | )) { |
bc1e29b5 |
37 | ok(!Foo->meta->has_method($function), '... the meta does not treat "' . $function . '" as a method'); |
38 | } |
39 | |
2f5dbc0b |
40 | foreach my $import (qw( |
41 | blessed |
42 | try |
43 | catch |
44 | in_global_destruction |
45 | )) { |
46 | ok(!Moose::Object->can($import), "no namespace pollution in Moose::Object ($import)" ); |
47 | |
48 | local $TODO = $import eq 'blessed' ? "no automatic namespace cleaning yet" : undef; |
49 | ok(!Foo->can($import), "no namespace pollution in Moose::Object ($import)" ); |
50 | } |
a28e50e4 |
51 | |
52 | done_testing; |