X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=blobdiff_plain;f=xt%2Foptional_deps.t;h=d73aab3df1617c7fb1475895d12b27bc939b1638;hb=34d2deae20e4426d7953c062a967ed096d7116f8;hp=66f6a6568fc06e82d6ccae9938013f457af4ab7f;hpb=be68095d16b02db81aa1c37dfd6f6595f19d1ac2;p=dbsrgits%2FDBIx-Class-Historic.git diff --git a/xt/optional_deps.t b/xt/optional_deps.t index 66f6a65..d73aab3 100644 --- a/xt/optional_deps.t +++ b/xt/optional_deps.t @@ -2,30 +2,26 @@ use strict; use warnings; no warnings qw/once/; -use Test::More; -use Test::Exception; -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 - -# a dummy test which lazy-loads more modules (so we can compare INC below) -ok (1); - -# record contents of %INC - makes sure there are no extra deps slipping into -# Opt::Dep. -my $inc_before = [ keys %INC ]; -ok ( (! grep { $_ =~ m|DBIx/Class| } @$inc_before ), 'Nothing DBIC related is yet loaded'); - +my ($inc_before, $inc_after); # DBIx::Class::Optional::Dependencies queries $ENV at compile time # to build the optional requirements BEGIN { $ENV{DBICTEST_PG_DSN} = '1'; - $ENV{DBICTEST_ORA_DSN} = undef; + delete $ENV{DBICTEST_ORA_DSN}; + + require Carp; # Carp is not used in the test, but in OptDeps, load for proper %INC comparison + + $inc_before = [ keys %INC ]; + require DBIx::Class::Optional::Dependencies; + $inc_after = [ keys %INC ]; } -use_ok 'DBIx::Class::Optional::Dependencies'; +use Test::More; +use Test::Exception; +use Scalar::Util; # load before we break require() -my $inc_after = [ keys %INC ]; +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], @@ -51,7 +47,14 @@ is_deeply ( like ( DBIx::Class::Optional::Dependencies->req_missing_for ('deploy'), - qr/^SQL::Translator \>\= \d/, + qr/ + (?: \A|\s ) + " SQL::Translator \~ \>\= [\d\.]+ " + \s + .*? + \Q(see DBIx::Class::Optional::Dependencies documentation for details)\E + \z + /x, 'expected missing string contents', ); @@ -119,7 +122,6 @@ is_deeply( is_deeply( DBIx::Class::Optional::Dependencies->req_list_for('test_rdbms_pg'), { - 'Sys::SigAction' => '0', 'DBD::Pg' => '2.009002', }, 'optional dependencies for testing Postgres with ENV var ok');