Get tests running under -T (cosmetics only)
[p5sagit/namespace-clean.git] / t / 10-pure-perl.t
index 1bbfd6e..2426afb 100644 (file)
@@ -9,13 +9,18 @@ BEGIN {
   plan skip_all => "B::Hooks::EndOfScope ($INC{'B/Hooks/EndOfScope.pm'}) loaded before the test even started >.<"
     if $INC{'B/Hooks/EndOfScope.pm'};
 
+  plan skip_all => "Package::Stash ($INC{'Package/Stash.pm'}) loaded before the test even started >.<"
+    if $INC{'Package/Stash.pm'};
+
   eval { require Variable::Magic }
     or plan skip_all => "PP tests already executed";
 
   $ENV{B_HOOKS_ENDOFSCOPE_IMPLEMENTATION} = 'PP';
+  $ENV{PACKAGE_STASH_IMPLEMENTATION} = 'PP';
 }
 
 use B::Hooks::EndOfScope 0.12;
+use Package::Stash;
 
 ok(
   ($INC{'B/Hooks/EndOfScope/PP.pm'} && ! $INC{'B/Hooks/EndOfScope/XS.pm'}),
@@ -25,22 +30,30 @@ ok(
   qw|EndOfScope.pm EndOfScope/XS.pm EndOfScope/PP.pm|
 ;
 
+ok(
+  ($INC{'Package/Stash/PP.pm'} && ! $INC{'Package/Stash/XS.pm'}),
+  'PP Package::Stash loaded properly'
+) || diag join "\n",
+  map { sprintf '%s => %s', $_, $INC{"Package/$_"} || 'undef' }
+  qw|Stash.pm Stash/XS.pm Stash/PP.pm|
+;
+
 use Config;
-use FindBin qw($Bin);
 use IPC::Open2 qw(open2);
 use File::Glob 'bsd_glob';
 
 # for the $^X-es
 $ENV{PERL5LIB} = join ($Config{path_sep}, @INC);
+$ENV{PATH} = '';
 
 
 # rerun the tests under the assumption of pure-perl
 my $this_file = quotemeta(__FILE__);
 
-for my $fn (bsd_glob("$Bin/*.t")) {
+for my $fn ( bsd_glob("t/*.t") ) {
   next if $fn =~ /${this_file}$/;
 
-  my @cmd = ($^X, $fn);
+  my @cmd = map { $_ =~ /(.+)/ } ($^X, $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