Ready for 0.01
[p5sagit/B-Hooks-EndOfScope-WithFallback.git] / t / 10-test_without_bheos.t
CommitLineData
4befcbc3 1use strict;
2use warnings;
3use Test::More;
4
5use B::Hooks::EndOfScope::WithFallback;
6
7plan skip_all => "Tests already executed without B::Hooks::EndOfScope"
8 unless B::Hooks::EndOfScope::WithFallback::__HAS_BHEOS;
9
10plan skip_all => "Variable::Magic still required for this test"
11 unless B::Hooks::EndOfScope::WithFallback::__HAS_VM;
12
13eval { require Devel::Hide }
14 or plan skip_all => "Devel::Hide required for this test in presence of B::Hooks::EndOfScope";
15
16use Config;
17use FindBin qw($Bin);
18use 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
25for 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
45done_testing;