From: Peter Rabbitson Date: Sun, 9 Dec 2012 04:30:16 +0000 (+0100) Subject: Reorganize PP test to fail comprehensibly on failed prereqs X-Git-Tag: 0.25~2 X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?p=p5sagit%2Fnamespace-clean.git;a=commitdiff_plain;h=666d9c2f822e7d3601811fef52633f7e748659d4 Reorganize PP test to fail comprehensibly on failed prereqs Prompted by http://www.cpantesters.org/cpan/report/33f54a42-3f59-11e2-b03f-503131b64f85 --- diff --git a/t/10-pure-perl.t b/t/10-pure-perl.t index 704ed30..1bbfd6e 100644 --- a/t/10-pure-perl.t +++ b/t/10-pure-perl.t @@ -2,16 +2,28 @@ use strict; use warnings; use Test::More; -plan skip_all => "PP tests already executed" - if $ENV{NAMESPACE_CLEAN_USE_PP}; +BEGIN { + plan skip_all => "PP tests already executed" + if $ENV{NAMESPACE_CLEAN_USE_PP}; -eval { require Variable::Magic } - or plan skip_all => "PP tests already executed"; + plan skip_all => "B::Hooks::EndOfScope ($INC{'B/Hooks/EndOfScope.pm'}) loaded before the test even started >.<" + if $INC{'B/Hooks/EndOfScope.pm'}; -$ENV{B_HOOKS_ENDOFSCOPE_IMPLEMENTATION} = 'PP'; -require B::Hooks::EndOfScope; -ok( ($INC{'B/Hooks/EndOfScope/PP.pm'} && ! $INC{'B/Hooks/EndOfScope/XS.pm'}), - 'PP BHEOS loaded properly'); + eval { require Variable::Magic } + or plan skip_all => "PP tests already executed"; + + $ENV{B_HOOKS_ENDOFSCOPE_IMPLEMENTATION} = 'PP'; +} + +use B::Hooks::EndOfScope 0.12; + +ok( + ($INC{'B/Hooks/EndOfScope/PP.pm'} && ! $INC{'B/Hooks/EndOfScope/XS.pm'}), + 'PP BHEOS loaded properly' +) || diag join "\n", + map { sprintf '%s => %s', $_, $INC{"B/Hooks/$_"} || 'undef' } + qw|EndOfScope.pm EndOfScope/XS.pm EndOfScope/PP.pm| +; use Config; use FindBin qw($Bin);