Make sure PP test re-run works on space containing paths
[gitmo/Class-C3.git] / t / 40_no_xs.t
CommitLineData
e861fe16 1use strict;
2use warnings;
3use Test::More;
4
5BEGIN {
6 plan skip_all => "PP tests not applicable for this perl $]"
7 if $] > 5.009_004;
8
9 plan skip_all => "All tests already executed in PP mode"
10 unless eval { require Class::C3::XS };
11
12 plan skip_all => "Devel::Hide required for this test"
13 unless eval { require Devel::Hide };
14}
15
16use Config;
17use IPC::Open2 qw(open2);
2266be0c 18use File::Glob 'bsd_glob';
e861fe16 19
20# for the $^X-es
21$ENV{PERL5LIB} = join ($Config{path_sep}, @INC);
22
23# rerun the tests under the assumption of pure-perl
24my $this_file = quotemeta(__FILE__);
25
2266be0c 26for my $fn (bsd_glob("t/*.t")) {
e861fe16 27 next if $fn =~ /${this_file}$/;
28
29 local $ENV{DEVEL_HIDE_VERBOSE} = 0;
30 my @cmd = (
31 $^X,
32 '-MDevel::Hide=Class::C3::XS',
33 $fn
34 );
35
36 # this is cheating, and may even hang here and there (testing on windows passed fine)
37 # if it does - will have to fix it somehow (really *REALLY* don't want to pull
38 # in IPC::Cmd just for a fucking test)
39 # the alternative would be to have an ENV check in each test to force a subtest
40 open2(my $out, my $in, @cmd);
41 while (my $ln = <$out>) {
42 print " $ln";
43 }
44
45 wait;
46 ok (! $?, "Exit $? from: @cmd");
47}
48
49done_testing;