Run the PP tests with or without Devek::Hide
[p5sagit/namespace-clean.git] / t / 10-pure-perl.t
index d77551e..825a899 100644 (file)
@@ -2,11 +2,15 @@ use strict;
 use warnings;
 use Test::More;
 
+plan skip_all => "PP tests already executed"
+  if $ENV{NAMESPACE_CLEAN_USE_PP};
+
 eval { require B::Hooks::EndOfScope }
   or plan skip_all => "PP tests already executed";
 
-eval { require Devel::Hide }
-  or plan skip_all => "Devel::Hide required for this test in presence of B::Hooks::EndOfScope";
+# the PP tests will run either wih D::H (mainly on smokers)
+# or by setting the envvar (for users)
+my $has_d_h = eval { require Devel::Hide };
 
 use Config;
 use FindBin qw($Bin);
@@ -22,7 +26,12 @@ for my $fn (glob("$Bin/*.t")) {
   next if $fn =~ /${this_file}$/;
 
   local $ENV{DEVEL_HIDE_VERBOSE} = 0;
-  my @cmd = ( $^X, '-MDevel::Hide=B::Hooks::EndOfScope', $fn );
+  local $ENV{NAMESPACE_CLEAN_USE_PP} = 1 unless $has_d_h;
+  my @cmd = (
+    $^X,
+    $has_d_h ? '-MDevel::Hide=B::Hooks::EndOfScope' : (),
+    $fn
+  );
 
   # this is cheating, and may even hang here and there (testing on windows passed fine)
   # if it does - will have to fix it somehow (really *REALLY* don't want to pull