From: Robert Sedlacek Date: Mon, 28 Nov 2011 21:05:26 +0000 (+0100) Subject: added test for renamable import X-Git-Tag: v1.000000~15 X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?p=p5sagit%2FPackage-Variant.git;a=commitdiff_plain;h=b6086e0da219b3dc46281b04c574a02e4fa2b5a5 added test for renamable import --- diff --git a/t/01simple.t b/t/01simple.t index 1520886..6cb6406 100644 --- a/t/01simple.t +++ b/t/01simple.t @@ -36,9 +36,11 @@ BEGIN { $INC{'TestVariable.pm'} = __FILE__; } -use TestVariable; - -my $variant = TestVariable(3..7); +my $variant = do { + package TestScopeA; + use TestVariable; + TestVariable(3..7); +}; ok defined($variant), 'new variant is a defined value'; ok length($variant), 'new variant has length'; @@ -53,4 +55,10 @@ is_deeply shift(@DECLARED), [class => 'TestVariable'], 'class method resolution'; is scalar(@DECLARED), 0, 'proxy sub called right amount of times'; +use TestVariable as => 'RenamedVar'; +is exception { + my $renamed = RenamedVar(9..12); + is_deeply $renamed->args, [9..12], 'imported generator can be renamed'; +}, undef, 'no errors for renamed usage'; + done_testing;