Changes for 0.91 re: constructor calling blessed
[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 => 22;
7 use Test::Exception;
8
9
10
11 {
12     package Foo;
13     use Moose;
14     use Moose::Util::TypeConstraints;
15 }
16
17 can_ok('Foo', 'meta');
18 isa_ok(Foo->meta, 'Moose::Meta::Class');
19
20 ok(Foo->meta->has_method('meta'), '... we got the &meta method');
21 ok(Foo->isa('Moose::Object'), '... Foo is automagically a Moose::Object');
22
23 dies_ok {
24    Foo->meta->has_method()
25 } '... has_method requires an arg';
26
27 dies_ok {
28    Foo->meta->has_method('')
29 } '... has_method requires an arg';
30
31 can_ok('Foo', 'does');
32
33 foreach my $function (qw(
34                          extends
35                          has
36                          before after around
37                          blessed confess
38                          type subtype as where
39                          coerce from via
40                          find_type_constraint
41                          )) {
42     ok(!Foo->meta->has_method($function), '... the meta does not treat "' . $function . '" as a method');
43 }
44