B::H::EOS is now PP-capable on its own
[p5sagit/namespace-clean.git] / t / 10-pure-perl.t
CommitLineData
9887772b 1use strict;
2use warnings;
3use Test::More;
4
37f19e68 5plan skip_all => "PP tests already executed"
6 if $ENV{NAMESPACE_CLEAN_USE_PP};
7
727a1a2f 8eval { require Variable::Magic }
9887772b 9 or plan skip_all => "PP tests already executed";
10
727a1a2f 11$ENV{B_HOOKS_ENDOFSCOPE_IMPLEMENTATION} = 'PP';
12require B::Hooks::EndOfScope;
13ok( ($INC{'B/Hooks/EndOfScope/PP.pm'} && ! $INC{'B/Hooks/EndOfScope/XS.pm'}),
14 'PP BHEOS loaded properly');
9887772b 15
16use Config;
17use FindBin qw($Bin);
18use IPC::Open2 qw(open2);
e6eee479 19use File::Glob 'bsd_glob';
9887772b 20
21# for the $^X-es
22$ENV{PERL5LIB} = join ($Config{path_sep}, @INC);
23
727a1a2f 24
9887772b 25# rerun the tests under the assumption of pure-perl
26my $this_file = quotemeta(__FILE__);
27
e6eee479 28for my $fn (bsd_glob("$Bin/*.t")) {
9887772b 29 next if $fn =~ /${this_file}$/;
30
727a1a2f 31 my @cmd = ($^X, $fn);
9887772b 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
46done_testing;