Work around 5.6.2 warnings
[gitmo/Mouse.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 => 29;
7 use Test::Exception;
8
9
10
11 {
12     package Foo;
13     use Mouse;
14     use Mouse::Util::TypeConstraints;
15 }
16
17 can_ok('Foo', 'meta');
18 isa_ok(Foo->meta, 'Mouse::Meta::Class');
19
20 ok(Foo->meta->has_method('meta'), '... we got the &meta method');
21 ok(Foo->isa('Mouse::Object'), '... Foo is automagically a Mouse::Object');
22
23 dies_ok {
24    Foo->meta->has_method()
25 } '... has_method requires an arg';
26
27 can_ok('Foo', 'does');
28
29 foreach my $function (qw(
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                          )) {
38     ok(!Foo->meta->has_method($function), '... the meta does not treat "' . $function . '" as a method');
39 }
40
41 foreach my $import (qw(
42     blessed
43     try
44     catch
45     in_global_destruction
46 )) {
47     ok(!Mouse::Object->can($import), "no namespace pollution in Mouse::Object ($import)" );
48
49     local $TODO = $import eq 'blessed' ? "no automatic namespace cleaning yet" : undef;
50     ok(!Foo->can($import), "no namespace pollution in Mouse::Object ($import)" );
51 }