From: Peter Rabbitson Date: Fri, 11 Jun 2010 09:19:15 +0000 (+0200) Subject: Test to make sure optional deps does not use any external modules X-Git-Tag: v0.08123~14 X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=3c3e76bd18fc509533a30b09cd64b46cef35d6c5;p=dbsrgits%2FDBIx-Class.git Test to make sure optional deps does not use any external modules --- diff --git a/xt/optional_deps.t b/xt/optional_deps.t index 9a59ac4..5e35930 100644 --- a/xt/optional_deps.t +++ b/xt/optional_deps.t @@ -5,9 +5,26 @@ 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 + +# 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'); use_ok 'DBIx::Class::Optional::Dependencies'; +my $inc_after = [ keys %INC ]; + +is_deeply ( + [ sort @$inc_after], + [ sort (@$inc_before, 'DBIx/Class/Optional/Dependencies.pm') ], + 'Nothing loaded other than DBIx::Class::OptDeps', +); + my $sqlt_dep = DBIx::Class::Optional::Dependencies->req_list_for ('deploy'); is_deeply ( [ keys %$sqlt_dep ],