From: Florian Ragwitz Date: Mon, 30 Nov 2009 14:29:05 +0000 (+0100) Subject: Add tests for Moose::Exporter warning when overwriting symbols. X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=11b0d40401dc2772f9b729c8cbf35b2b0260b8a0;p=gitmo%2FMoose.git Add tests for Moose::Exporter warning when overwriting symbols. --- diff --git a/t/050_metaclasses/012_moose_exporter.t b/t/050_metaclasses/012_moose_exporter.t index c6c1f4d..2809867 100644 --- a/t/050_metaclasses/012_moose_exporter.t +++ b/t/050_metaclasses/012_moose_exporter.t @@ -5,12 +5,12 @@ use warnings; use Test::More; use Test::Exception; + BEGIN { eval "use Test::Output;"; plan skip_all => "Test::Output is required for this test" if $@; } - { package HasOwnImmutable; @@ -389,4 +389,18 @@ BEGIN { for qw( with_meta1 with_meta2 with_caller1 with_caller2 as_is1 ); } +{ + package AlreadyHasImport; + + sub as_is1 { 42 } + + ::stderr_like( + sub { AllOptions->import('as_is1') }, + qr/AllOptions is overwriting symbol as_is1 at ${\__FILE__}/, + 'warning when overwriting existign symbols', + ); + + ::is(as_is1, 2, 'import got overwritten'); +} + done_testing;