has_method now allows a false value in CMOP
[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
e522431d 20ok(Foo->meta->has_method('meta'), '... we got the &meta method');
bc1e29b5 21ok(Foo->isa('Moose::Object'), '... Foo is automagically a Moose::Object');
22
bbd2fe69 23dies_ok {
d03bd989 24 Foo->meta->has_method()
bbd2fe69 25} '... has_method requires an arg';
26
ef333f17 27can_ok('Foo', 'does');
28
bc1e29b5 29foreach my $function (qw(
f4fce6c8 30 extends
31 has
32 before after around
33 blessed confess
34 type subtype as where
35 coerce from via
36 find_type_constraint
37 )) {
bc1e29b5 38 ok(!Foo->meta->has_method($function), '... the meta does not treat "' . $function . '" as a method');
39}
40
2f5dbc0b 41foreach my $import (qw(
42 blessed
43 try
44 catch
45 in_global_destruction
46)) {
47 ok(!Moose::Object->can($import), "no namespace pollution in Moose::Object ($import)" );
48
49 local $TODO = $import eq 'blessed' ? "no automatic namespace cleaning yet" : undef;
50 ok(!Foo->can($import), "no namespace pollution in Moose::Object ($import)" );
51}