22a44b8b592f6a5ac728dd116ae0e38576d05825
[p5sagit/B-Hooks-EndOfScope-WithFallback.git] / t / 10-test_without_bheos.t
1 use strict;
2 use warnings;
3 use Test::More;
4
5 use B::Hooks::EndOfScope::WithFallback;
6
7 plan skip_all => "Tests already executed without B::Hooks::EndOfScope"
8   unless B::Hooks::EndOfScope::WithFallback::__HAS_BHEOS;
9
10 plan skip_all => "Variable::Magic still required for this test"
11   unless B::Hooks::EndOfScope::WithFallback::__HAS_VM;
12
13 eval { require Devel::Hide }
14   or plan skip_all => "Devel::Hide required for this test in presence of B::Hooks::EndOfScope";
15
16 use Config;
17 use FindBin qw($Bin);
18 use IPC::Open2 qw(open2);
19
20 # for the $^X-es
21 $ENV{PERL5LIB} = join ($Config{path_sep}, @INC);
22
23 # rerun the tests under the assumption of no bheos but a present vm
24
25 for my $fn (glob("$Bin/*.t")) {
26   next if $fn =~ /test_without_/;
27
28   local $ENV{DEVEL_HIDE_VERBOSE} = 0;
29   note "retesting $fn";
30   my @cmd = ( $^X, '-MDevel::Hide=B::Hooks::EndOfScope', $fn );
31
32   # this is cheating, and may even hang here and there (testing on windows passed fine)
33   # if it does - will have to fix it somehow (really *REALLY* don't want to pull
34   # in IPC::Cmd just for a fucking test)
35   # the alternative would be to have an ENV check in each test to force a subtest
36   open2(my $out, my $in, @cmd);
37   while (my $ln = <$out>) {
38     print "   $ln";
39   }
40
41   wait;
42   ok (! $?, "Exit $? from: @cmd");
43 }
44
45 done_testing;