complete re-organization of the test suite
[gitmo/Moose.git] / t / 010_basics / 001_basic_class_setup.t
CommitLineData
bc1e29b5 1#!/usr/bin/perl
2
3use strict;
4use warnings;
5
bbd2fe69 6use Test::More tests => 23;
bc1e29b5 7use Test::Exception;
8
9BEGIN {
10 use_ok('Moose');
11}
12
13{
14 package Foo;
15 use Moose;
05d9eaf6 16 use Moose::Util::TypeConstraints;
bc1e29b5 17}
18
19can_ok('Foo', 'meta');
20isa_ok(Foo->meta, 'Moose::Meta::Class');
21
e522431d 22ok(Foo->meta->has_method('meta'), '... we got the &meta method');
bc1e29b5 23ok(Foo->isa('Moose::Object'), '... Foo is automagically a Moose::Object');
24
bbd2fe69 25dies_ok {
26 Foo->meta->has_method()
27} '... has_method requires an arg';
28
29dies_ok {
30 Foo->meta->has_method('')
31} '... has_method requires an arg';
32
ef333f17 33can_ok('Foo', 'does');
34
bc1e29b5 35foreach 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