tests for metaclass() export
[gitmo/Moose.git] / t / 010_basics / 001_basic_class_setup.t
1 #!/usr/bin/perl
2
3 use strict;
4 use warnings;
5
6 use Test::More tests => 23;
7 use Test::Exception;
8
9 BEGIN {
10     use_ok('Moose');           
11 }
12
13 {
14     package Foo;
15     use Moose;
16     use Moose::Util::TypeConstraints;
17 }
18
19 can_ok('Foo', 'meta');
20 isa_ok(Foo->meta, 'Moose::Meta::Class');
21
22 ok(Foo->meta->has_method('meta'), '... we got the &meta method');
23 ok(Foo->isa('Moose::Object'), '... Foo is automagically a Moose::Object');
24
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
33 can_ok('Foo', 'does');
34
35 foreach my $function (qw(
36                                                  extends
37                          has 
38                              before after around
39                              blessed confess
40                                                  type subtype as where
41                                                  coerce from via
42                                                  find_type_constraint
43                              )) {
44     ok(!Foo->meta->has_method($function), '... the meta does not treat "' . $function . '" as a method');
45 }
46