Institute a central "load this first in testing" package
[dbsrgits/DBIx-Class-Historic.git] / t / storage / debug.t
index e023fff..e3cef38 100644 (file)
@@ -1,17 +1,26 @@
+BEGIN { do "./t/lib/ANFANG.pm" or die ( $@ || $! ) }
+
 use strict;
 use warnings;
 no warnings 'once';
 
+BEGIN {
+  delete @ENV{qw(
+    DBIC_TRACE
+    DBIC_TRACE_PROFILE
+    DBICTEST_SQLITE_USE_FILE
+    DBICTEST_VIA_REPLICATED
+  )};
+}
+
 use Test::More;
 use Test::Exception;
 use Try::Tiny;
 use File::Spec;
-use lib qw(t/lib);
+
 use DBICTest;
 use Path::Class qw/file/;
 
-BEGIN { delete @ENV{qw(DBIC_TRACE DBIC_TRACE_PROFILE DBICTEST_SQLITE_USE_FILE)} }
-
 my $schema = DBICTest->init_schema();
 
 my $lfn = file("t/var/sql-$$.log");
@@ -69,11 +78,12 @@ my $exception = try {
   open(STDERR, '>&STDERRCOPY');
 };
 
-like $exception, qr/
+ok $exception =~ /
   \QDuplication of STDERR for debug output failed (perhaps your STDERR is closed?)\E
     .+
   \Qat @{[__FILE__]} line $exception_line_number\E$
-/xms;
+/xms
+  or diag "Unexpected exception text:\n\n$exception\n";
 
 my @warnings;
 $exception = try {