X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=blobdiff_plain;f=xt%2Foptional_deps.t;h=11ef4d1c4da2db35641c314ed2764982a962fe4d;hb=84f7e8a1c6303091d753572648e37d3bd7270181;hp=5e35930a2765b9b9aa9e7243c08744b9651df436;hpb=3c3e76bd18fc509533a30b09cd64b46cef35d6c5;p=dbsrgits%2FDBIx-Class.git diff --git a/xt/optional_deps.t b/xt/optional_deps.t index 5e35930..11ef4d1 100644 --- a/xt/optional_deps.t +++ b/xt/optional_deps.t @@ -5,7 +5,7 @@ no warnings qw/once/; use Test::More; use lib qw(t/lib); use Scalar::Util; # load before we break require() -use Carp (); # Carp is not used in the test, but we want to have it loaded for proper %INC comparison +use Carp (); # Carp is not used in the test, but we want to have it loaded for proper %INC comparison # a dummy test which lazy-loads more modules (so we can compare INC below) ok (1); @@ -33,25 +33,26 @@ is_deeply ( ); # make module loading impossible, regardless of actual libpath contents -@INC = (sub { die('Optional Dep Test') } ); - -ok ( - ! DBIx::Class::Optional::Dependencies->req_ok_for ('deploy'), - 'deploy() deps missing', -); - -like ( - DBIx::Class::Optional::Dependencies->req_missing_for ('deploy'), - qr/^SQL::Translator \>\= \d/, - 'expected missing string contents', -); - -like ( - DBIx::Class::Optional::Dependencies->req_errorlist_for ('deploy')->{'SQL::Translator'}, - qr/Optional Dep Test/, - 'custom exception found in errorlist', -); - +{ + local @INC = (sub { die('Optional Dep Test') } ); + + ok ( + ! DBIx::Class::Optional::Dependencies->req_ok_for ('deploy'), + 'deploy() deps missing', + ); + + like ( + DBIx::Class::Optional::Dependencies->req_missing_for ('deploy'), + qr/^SQL::Translator \>\= \d/, + 'expected missing string contents', + ); + + like ( + DBIx::Class::Optional::Dependencies->req_errorlist_for ('deploy')->{'SQL::Translator'}, + qr/Optional Dep Test/, + 'custom exception found in errorlist', + ); +} #make it so module appears loaded $INC{'SQL/Translator.pm'} = 1; @@ -83,5 +84,4 @@ is_deeply ( 'expected empty errorlist', ); - done_testing;