DEATH TO ALL zionist ELLIPSES
[gitmo/Moose.git] / t / 010_basics / 001_basic_class_setup.t
CommitLineData
bc1e29b5 1#!/usr/bin/perl
2
3use strict;
4use warnings;
5
2f5dbc0b 6use Test::More tests => 30;
bc1e29b5 7use Test::Exception;
8
7ff56534 9
bc1e29b5 10
11{
12 package Foo;
13 use Moose;
05d9eaf6 14 use Moose::Util::TypeConstraints;
bc1e29b5 15}
16
17can_ok('Foo', 'meta');
18isa_ok(Foo->meta, 'Moose::Meta::Class');
19
1808c2da 20ok(Foo->meta->has_method('meta'), 'we got the &meta method');
21ok(Foo->isa('Moose::Object'), 'Foo is automagically a Moose::Object');
bc1e29b5 22
bbd2fe69 23dies_ok {
d03bd989 24 Foo->meta->has_method()
1808c2da 25} 'has_method requires an arg';
bbd2fe69 26
27dies_ok {
d03bd989 28 Foo->meta->has_method('')
1808c2da 29} 'has_method requires an arg';
bbd2fe69 30
ef333f17 31can_ok('Foo', 'does');
32
bc1e29b5 33foreach my $function (qw(
f4fce6c8 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 )) {
1808c2da 42 ok(!Foo->meta->has_method($function), 'the meta does not treat "' . $function . '" as a method');
bc1e29b5 43}
44
2f5dbc0b 45foreach my $import (qw(
46 blessed
47 try
48 catch
49 in_global_destruction
50)) {
51 ok(!Moose::Object->can($import), "no namespace pollution in Moose::Object ($import)" );
52
53 local $TODO = $import eq 'blessed' ? "no automatic namespace cleaning yet" : undef;
54 ok(!Foo->can($import), "no namespace pollution in Moose::Object ($import)" );
55}