Add another MOOSE_TEST_MD option, MooseX
[gitmo/Moose.git] / t / basics / basic_class_setup.t
CommitLineData
bc1e29b5 1#!/usr/bin/perl
2
3use strict;
4use warnings;
5
a28e50e4 6use Test::More;
b10dde3a 7use Test::Fatal;
bc1e29b5 8
7ff56534 9
bc1e29b5 10{
11 package Foo;
12 use Moose;
05d9eaf6 13 use Moose::Util::TypeConstraints;
bc1e29b5 14}
15
16can_ok('Foo', 'meta');
17isa_ok(Foo->meta, 'Moose::Meta::Class');
18
e522431d 19ok(Foo->meta->has_method('meta'), '... we got the &meta method');
bc1e29b5 20ok(Foo->isa('Moose::Object'), '... Foo is automagically a Moose::Object');
21
b10dde3a 22isnt( exception {
d03bd989 23 Foo->meta->has_method()
b10dde3a 24}, undef, '... has_method requires an arg' );
bbd2fe69 25
ef333f17 26can_ok('Foo', 'does');
27
bc1e29b5 28foreach my $function (qw(
f4fce6c8 29 extends
30 has
31 before after around
32 blessed confess
33 type subtype as where
34 coerce from via
35 find_type_constraint
36 )) {
bc1e29b5 37 ok(!Foo->meta->has_method($function), '... the meta does not treat "' . $function . '" as a method');
38}
39
2f5dbc0b 40foreach my $import (qw(
41 blessed
42 try
43 catch
44 in_global_destruction
45)) {
46 ok(!Moose::Object->can($import), "no namespace pollution in Moose::Object ($import)" );
47
48 local $TODO = $import eq 'blessed' ? "no automatic namespace cleaning yet" : undef;
49 ok(!Foo->can($import), "no namespace pollution in Moose::Object ($import)" );
50}
a28e50e4 51
52done_testing;