X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=blobdiff_plain;f=t%2F010_basics%2F001_basic_class_setup.t;h=22993759b4ba7a9bb9d383d7dbe9181135bdd4f8;hb=be0ed15704fdad5f2d8517380a6f24687432c1dd;hp=05203946f18c9cb00ee6177bad9559af3ef82700;hpb=7ff5653479c2bfc0794635f7fbade9bfe7bb2381;p=gitmo%2FMoose.git diff --git a/t/010_basics/001_basic_class_setup.t b/t/010_basics/001_basic_class_setup.t index 0520394..2299375 100644 --- a/t/010_basics/001_basic_class_setup.t +++ b/t/010_basics/001_basic_class_setup.t @@ -3,9 +3,8 @@ use strict; use warnings; -use Test::More tests => 22; -use Test::Exception; - +use Test::More; +use Test::Fatal; { @@ -20,25 +19,34 @@ isa_ok(Foo->meta, 'Moose::Meta::Class'); ok(Foo->meta->has_method('meta'), '... we got the &meta method'); ok(Foo->isa('Moose::Object'), '... Foo is automagically a Moose::Object'); -dies_ok { - Foo->meta->has_method() -} '... has_method requires an arg'; - -dies_ok { - Foo->meta->has_method('') -} '... has_method requires an arg'; +ok exception { + Foo->meta->has_method() +}, '... has_method requires an arg'; can_ok('Foo', 'does'); foreach my $function (qw( - extends - has - before after around - blessed confess - type subtype as where - coerce from via - find_type_constraint - )) { + extends + has + before after around + blessed confess + type subtype as where + coerce from via + find_type_constraint + )) { ok(!Foo->meta->has_method($function), '... the meta does not treat "' . $function . '" as a method'); } +foreach my $import (qw( + blessed + try + catch + in_global_destruction +)) { + ok(!Moose::Object->can($import), "no namespace pollution in Moose::Object ($import)" ); + + local $TODO = $import eq 'blessed' ? "no automatic namespace cleaning yet" : undef; + ok(!Foo->can($import), "no namespace pollution in Moose::Object ($import)" ); +} + +done_testing;