Restructure handling of the test scratch-dir, move all activity
[dbsrgits/DBIx-Class-Schema-Loader.git] / t / 22dump.t
index cdb0f50..0b3a2f8 100644 (file)
@@ -3,8 +3,14 @@ use Test::More;
 use lib qw(t/lib);
 use File::Path;
 use make_dbictest_db;
+use dbixcsl_test_dir qw/$tdir/;
 
-my $dump_path = './t/_dump';
+my $dump_path = "$tdir/dump";
+
+local $SIG{__WARN__} = sub {
+    warn $_[0] unless $_[0] =~
+        /really_erase_my_files|Dumping manual schema|Schema dump completed/;
+};
 
 {
     package DBICTest::Schema::1;
@@ -33,7 +39,12 @@ ok(!$@, 'no death with dump_directory set') or diag "Dump failed: $@";
 DBICTest::Schema::1->_loader_invoked(undef);
 
 SKIP: {
-  skip "ActiveState perl produces additional warnings", 3
+  my @warnings_regexes = (
+      qr|Dumping manual schema|,
+      qr|Schema dump completed|,
+  );
+
+  skip "ActiveState perl produces additional warnings", scalar @warnings_regexes
     if ($^O eq 'MSWin32');
 
   my @warn_output;
@@ -41,10 +52,6 @@ SKIP: {
       local $SIG{__WARN__} = sub { push(@warn_output, @_) };
       DBICTest::Schema::1->connect($make_dbictest_db::dsn);
   }
-  my @warnings_regexes = (
-      qr|Dumping manual schema|,
-      qr|Schema dump completed|,
-  );
 
   like(shift @warn_output, $_) foreach (@warnings_regexes);