From: Peter Rabbitson Date: Thu, 12 Mar 2015 09:36:47 +0000 (+0100) Subject: Fix brainfart from cb551b07 - 'if' is still a module, don't need it X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?p=dbsrgits%2FDBIx-Class.git;a=commitdiff_plain;h=bd510251c6bf4e9c4c28f0eb1e763776e106f8ce Fix brainfart from cb551b07 - 'if' is still a module, don't need it Also rewrite the load pattern test to be saner --- diff --git a/lib/DBIx/Class/Optional/Dependencies.pm b/lib/DBIx/Class/Optional/Dependencies.pm index d1d8bba..7e69eea 100644 --- a/lib/DBIx/Class/Optional/Dependencies.pm +++ b/lib/DBIx/Class/Optional/Dependencies.pm @@ -2,8 +2,12 @@ package DBIx::Class::Optional::Dependencies; ### This may look crazy, but it in fact tangibly ( by 50(!)% ) shortens # the skip-test time when everything requested is unavailable -use if $ENV{RELEASE_TESTING} => 'warnings'; -use if $ENV{RELEASE_TESTING} => 'strict'; +BEGIN { + if ( $ENV{RELEASE_TESTING} ) { + require warnings and warnings->import; + require strict and strict->import; + } +} sub croak { require Carp; diff --git a/xt/extra/internals/optional_deps.t b/xt/extra/internals/optional_deps.t index 9cef633..c33fd23 100644 --- a/xt/extra/internals/optional_deps.t +++ b/xt/extra/internals/optional_deps.t @@ -18,14 +18,20 @@ use MRO::Compat(); use Carp 'confess'; use List::Util 'shuffle'; -ok ( (! grep { $_ =~ m|DBIx/Class| } @$inc_before ), 'Nothing DBIC related was loaded before inc-test') - unless $ENV{PERL5OPT}; # a defined PERL5OPT may inject extra deps crashing this test - -is_deeply ( - [ sort @$inc_after], - [ sort (@$inc_before, qw( DBIx/Class/Optional/Dependencies.pm if.pm )) ], - 'Nothing loaded other than DBIx::Class::OptDeps', -) unless $ENV{RELEASE_TESTING}; +SKIP: { + skip 'Lean load pattern testing unsafe with $ENV{PERL5OPT}', 1 if $ENV{PERL5OPT}; + skip 'Lean load pattern testing useless with $ENV{RELEASE_TESTING}', 1 if $ENV{RELEASE_TESTING}; + is_deeply + $inc_before, + [], + 'Nothing was loaded before inc-test' + ; + is_deeply + $inc_after, + [ 'DBIx/Class/Optional/Dependencies.pm' ], + 'Nothing was loaded other than DBIx::Class::OptDeps' + ; +} # check the project-local groups for sanity lives_ok {