move repo to github moose org
[gitmo/Class-C3.git] / t / 40_no_xs.t
1 use strict;
2 use warnings;
3 use Test::More;
4
5 BEGIN {
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
16 use Config;
17 use IPC::Open2 qw(open2);
18 use File::Glob 'bsd_glob';
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
24 my $this_file = quotemeta(__FILE__);
25
26 for my $fn (bsd_glob("t/*.t")) {
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
49 done_testing;