B::H::EOS is now PP-capable on its own
[p5sagit/namespace-clean.git] / t / 10-pure-perl.t
1 use strict;
2 use warnings;
3 use Test::More;
4
5 plan skip_all => "PP tests already executed"
6   if $ENV{NAMESPACE_CLEAN_USE_PP};
7
8 eval { require Variable::Magic }
9   or plan skip_all => "PP tests already executed";
10
11 $ENV{B_HOOKS_ENDOFSCOPE_IMPLEMENTATION} = 'PP';
12 require B::Hooks::EndOfScope;
13 ok( ($INC{'B/Hooks/EndOfScope/PP.pm'} && ! $INC{'B/Hooks/EndOfScope/XS.pm'}),
14   'PP BHEOS loaded properly');
15
16 use Config;
17 use FindBin qw($Bin);
18 use IPC::Open2 qw(open2);
19 use File::Glob 'bsd_glob';
20
21 # for the $^X-es
22 $ENV{PERL5LIB} = join ($Config{path_sep}, @INC);
23
24
25 # rerun the tests under the assumption of pure-perl
26 my $this_file = quotemeta(__FILE__);
27
28 for my $fn (bsd_glob("$Bin/*.t")) {
29   next if $fn =~ /${this_file}$/;
30
31   my @cmd = ($^X, $fn);
32
33   # this is cheating, and may even hang here and there (testing on windows passed fine)
34   # if it does - will have to fix it somehow (really *REALLY* don't want to pull
35   # in IPC::Cmd just for a fucking test)
36   # the alternative would be to have an ENV check in each test to force a subtest
37   open2(my $out, my $in, @cmd);
38   while (my $ln = <$out>) {
39     print "   $ln";
40   }
41
42   wait;
43   ok (! $?, "Exit $? from: @cmd");
44 }
45
46 done_testing;