Commit | Line | Data |
bc1e29b5 |
1 | #!/usr/bin/perl |
2 | |
3 | use strict; |
4 | use warnings; |
5 | |
bbd2fe69 |
6 | use Test::More tests => 23; |
bc1e29b5 |
7 | use Test::Exception; |
8 | |
9 | BEGIN { |
10 | use_ok('Moose'); |
11 | } |
12 | |
13 | { |
14 | package Foo; |
15 | use Moose; |
05d9eaf6 |
16 | use Moose::Util::TypeConstraints; |
bc1e29b5 |
17 | } |
18 | |
19 | can_ok('Foo', 'meta'); |
20 | isa_ok(Foo->meta, 'Moose::Meta::Class'); |
21 | |
e522431d |
22 | ok(Foo->meta->has_method('meta'), '... we got the &meta method'); |
bc1e29b5 |
23 | ok(Foo->isa('Moose::Object'), '... Foo is automagically a Moose::Object'); |
24 | |
bbd2fe69 |
25 | dies_ok { |
26 | Foo->meta->has_method() |
27 | } '... has_method requires an arg'; |
28 | |
29 | dies_ok { |
30 | Foo->meta->has_method('') |
31 | } '... has_method requires an arg'; |
32 | |
ef333f17 |
33 | can_ok('Foo', 'does'); |
34 | |
bc1e29b5 |
35 | foreach my $function (qw( |
36 | extends |
37 | has |
38 | before after around |
39 | blessed confess |
a15dff8d |
40 | type subtype as where |
6ba6d68c |
41 | coerce from via |
42 | find_type_constraint |
bc1e29b5 |
43 | )) { |
44 | ok(!Foo->meta->has_method($function), '... the meta does not treat "' . $function . '" as a method'); |
45 | } |
46 | |