Work around EUMM 7.06 creating an empty blib/ dir, breaking prove -lr
[dbsrgits/DBIx-Class.git] / t / 55namespaces_cleaned.t
index 875a77d..de47f14 100644 (file)
@@ -93,6 +93,8 @@ my $skip_idx = { map { $_ => 1 } (
 
 my $has_moose = eval { require Moose::Util };
 
+Sub::Defer::undefer_all();
+
 # can't use Class::Inspector for the mundane parts as it does not
 # distinguish imports from anything else, what a crock of...
 # Moose is not always available either - hence just do it ourselves
@@ -149,9 +151,18 @@ for my $mod (@modules) {
             last;
           }
         }
-        fail ("${mod}::${name} appears to have entered inheritance chain by import into "
-            . ($via || 'UNKNOWN')
-        );
+
+        # exception time
+        if (
+          ( $name eq 'import' and $via = 'Exporter' )
+        ) {
+          pass("${mod}::${name} is a valid uncleaned import from ${name}");
+        }
+        else {
+          fail ("${mod}::${name} appears to have entered inheritance chain by import into "
+              . ($via || 'UNKNOWN')
+          );
+        }
       }
     }
 
@@ -179,7 +190,7 @@ for my $mod (@modules) {
 sub find_modules {
   my @modules;
 
-  find({
+  find( {
     wanted => sub {
       -f $_ or return;
       s/\.pm$// or return;
@@ -187,7 +198,12 @@ sub find_modules {
       push @modules, join ('::', File::Spec->splitdir($_));
     },
     no_chdir => 1,
-  }, (-e 'blib' ? 'blib' : 'lib') );
+  }, (
+    # find them in both lib and blib, duplicates are fine, since
+    # @INC is preadjusted for us by the harness
+    'lib',
+    ( -e 'blib' ? 'blib' : () ),
+  ));
 
   return sort @modules;
 }