From: Christian Walde Date: Wed, 5 Sep 2012 13:23:16 +0000 (+0200) Subject: added failing unimport test that demonstrates clobbering of package globals X-Git-Tag: v1.000008~10 X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=cbbfd457a8222bb468f1245e28fed18908548e03;p=gitmo%2FMoo.git added failing unimport test that demonstrates clobbering of package globals --- diff --git a/t/no-moo.t b/t/no-moo.t index 74ed54e..0388a2b 100644 --- a/t/no-moo.t +++ b/t/no-moo.t @@ -69,6 +69,19 @@ use Test::More; main::is_deeply(\%stash, \%stash2, "stash of non-Moo role remains untouched"); } +{ + package GlobalConflict2; + + use Moo; + + no warnings 'redefine'; + + our $after = "has!"; + sub has { $after } + + no Moo; +} + ok(!Spoon->can('extends'), 'extends cleaned'); is(Spoon->has, "has!", 'has left alone'); @@ -87,4 +100,11 @@ is(GlobalConflict->has, "has!", 'has left alone'); ok(RollerTiny->can('around'), 'around left alone'); is(RollerTiny->with, "with!", 'with left alone'); +ok(!GlobalConflict2->can('extends'), 'extends cleaned'); +is(GlobalConflict2->has, "has!", 'has left alone'); +{ + no warnings 'once'; + is($GlobalConflict2::after, "has!", 'package global left alone'); +} + done_testing;