From: Vincent Pit Date: Fri, 8 Apr 2011 18:22:52 +0000 (+0200) Subject: Handle all-negated imports properly X-Git-Tag: v0.03~9 X-Git-Url: http://git.vpit.fr/?a=commitdiff_plain;h=8cfb19acee48ec3c66f725ec5037f9e137118e31;p=perl%2Fmodules%2FTest-Leaner.git Handle all-negated imports properly In particular, make sure stubs are imported with old versions of Test::More. --- diff --git a/lib/Test/Leaner.pm b/lib/Test/Leaner.pm index f43be92..344d10d 100644 --- a/lib/Test/Leaner.pm +++ b/lib/Test/Leaner.pm @@ -185,7 +185,13 @@ if ($ENV{PERL_TEST_LEANER_USES_TEST_MORE}) { my $class = shift; my @imports = &_handle_import_args; - @imports = @EXPORT unless @imports; + if (@imports == grep /^!/, @imports) { + # All imports are negated, or @imports is empty + my %negated; + /^!(.*)/ and ++$negated{$1} for @imports; + push @imports, grep !$negated{$_}, @EXPORT; + } + my @test_more_imports; for (@imports) { if ($stubbed{$_}) {