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