1 package # hide from pauses
6 if ( $ENV{RELEASE_TESTING} ) {
7 require warnings and warnings->import;
8 require strict and strict->import;
11 # allow 'use ANFANG' to work after it's been do()ne
12 $INC{"ANFANG.pm"} ||= __FILE__;
13 $INC{"t/lib/ANFANG.pm"} ||= __FILE__;
14 $INC{"./t/lib/ANFANG.pm"} ||= __FILE__;
19 # load-me-first sanity check
23 ! $ENV{DBICTEST_ANFANG_DEFANG}
27 # if this is set - all bets are off
32 # -d:Confess / -d:TraceUse and the like
37 # just don't check anything under RELEASE_TESTING
38 # a naive approach would be to simply whitelist both
39 # strict and warnings, but pre 5.10 there were even
40 # more modules loaded by these two:
42 # perlbrew exec perl -Mstrict -Mwarnings -e 'warn join "\n", sort keys %INC'
44 ! $ENV{RELEASE_TESTING}
48 my @undesirables = grep {
50 ($INC{$_}||'') ne __FILE__
54 # allow direct loads via -M
55 $_ !~ m{^ DBICTest (?: /Schema )? \.pm $}x
62 while (@frame = caller(++$fr)) {
63 last if $frame[1] !~ m{ (?: \A | [\/\\] ) t [\/\\] lib [\/\\] }x;
66 die __FILE__ . " must be loaded before any other module (i.e. @{[ join ', ', map { qq('$_') } sort @undesirables ]}) at $frame[1] line $frame[2]\n";
70 if ( $ENV{DBICTEST_VERSION_WARNS_INDISCRIMINATELY} ) {
71 my $ov = UNIVERSAL->can("VERSION");
75 # not loading warnings.pm
78 *UNIVERSAL::VERSION = sub {
79 Carp::carp( 'Argument "blah bleh bloh" isn\'t numeric in subroutine entry' );
86 $ENV{DBICTEST_ASSERT_NO_SPURIOUS_EXCEPTION_ACTION}
88 # keep it always on during CI
90 ($ENV{TRAVIS}||'') eq 'true'
92 ($ENV{TRAVIS_REPO_SLUG}||'') =~ m|\w+/dbix-class$|
96 my $orig = \&Try::Tiny::try;
98 # not loading warnings.pm
101 *Try::Tiny::try = sub (&;@) {
102 my ($fr, $first_pkg) = 0;
103 while( $first_pkg = caller($fr++) ) {
104 last if $first_pkg !~ /^
111 if ($first_pkg =~ /DBIx::Class/) {
112 require Test::Builder;
113 Test::Builder->new->ok(0,
114 'Using try{} within DBIC internals is a mistake - use dbic_internal_try{} instead'
126 # everything expects this to be there
130 die "Unable to create 't/var': $!\n"
133 # Back in ab340f7f ribasushi stupidly introduced a "did you check your deps"
134 # verification tied very tightly to Module::Install. The check went away, and
135 # so eventually will M::I, but bisecting can bring all of this back from the
136 # dead. In order to reduce hair-pulling make sure that ./inc/ is always there
137 -f 'Makefile.PL' and mkdir 'inc' and mkdir 'inc/.author';