]> git.vpit.fr Git - perl/modules/Test-Leaner.git/blobdiff - lib/Test/Leaner.pm
Fix the handling of the "import" import argument
[perl/modules/Test-Leaner.git] / lib / Test / Leaner.pm
index 72531845aac4a400a729807632de6ae37213c3ca..8e45f3c8bfe9d4a24266ffeea5b68c78d5263eac 100644 (file)
@@ -165,14 +165,13 @@ if ($ENV{PERL_TEST_LEANER_USES_TEST_MORE}) {
  my $leaner_stash = \%Test::Leaner::;
  my $more_stash   = \%Test::More::;
 
- my %valid_imports;
+ my %stubbed;
 
  for (@EXPORT) {
   my $replacement = exists $more_stash->{$_} ? *{$more_stash->{$_}}{CODE}
                                              : undef;
-  if (defined $replacement) {
-   $valid_imports{$_} = 1;
-  } else {
+  unless (defined $replacement) {
+   $stubbed{$_}++;
    $replacement = sub {
     @_ = ("$_ is not implemented in this version of Test::More");
     goto &croak;
@@ -186,15 +185,15 @@ if ($ENV{PERL_TEST_LEANER_USES_TEST_MORE}) {
   shift;
 
   my @imports = &_handle_import_args;
-  @imports = @EXPORT unless @imports;
+  @imports    = @EXPORT unless @imports;
   my @test_more_imports;
   for (@imports) {
-   if ($valid_imports{$_}) {
-    push @test_more_imports, $_;
-   } else {
+   if ($stubbed{$_}) {
     my $pkg = caller;
     no strict 'refs';
     *{$pkg."::$_"} = $leaner_stash->{$_};
+   } else {
+    push @test_more_imports, $_;
    }
   }