Update Firebird ODBC driver download URL
[dbsrgits/DBIx-Class-Schema-Loader.git] / t / lib / dbixcsl_dumper_tests.pm
index d16a3bb..912cb17 100644 (file)
@@ -1,6 +1,7 @@
 package dbixcsl_dumper_tests;
 
 use strict;
+use warnings;
 use Test::More;
 use File::Path;
 use IPC::Open3;
@@ -64,8 +65,8 @@ sub _dump_directly {
     no strict 'refs';
     @{$schema_class . '::ISA'} = ('DBIx::Class::Schema::Loader');
     $schema_class->loader_options(
-      quiet => 1,
-      %{$tdata{options}},
+        quiet => 1,
+        %{$tdata{options}},
     );
 
     my @warns;
@@ -176,7 +177,7 @@ sub _test_dumps {
     my $check_warns = $tdata{warnings};
 
     is(@$warns, @$check_warns, "$schema_class warning count")
-      or diag @$warns;
+        or diag @$warns;
 
     for(my $i = 0; $i <= $#$check_warns; $i++) {
         like(($warns->[$i] || ''), $check_warns->[$i], "$schema_class warning $i");
@@ -210,19 +211,21 @@ sub _test_dumps {
     }
 }
 
-sub _dump_file_like {
+sub _slurp {
     my $path = shift;
-    open(my $dumpfh, '<', $path) or die "Failed to open '$path': $!";
+    open(my $dumpfh, '<:raw', $path) or die "Failed to open '$path': $!";
     my $contents = do { local $/; <$dumpfh>; };
     close($dumpfh);
+    return ($path, $contents);
+}
+
+sub _dump_file_like {
+    my ($path, $contents) = _slurp shift;
     like($contents, $_, "$path matches $_") for @_;
 }
 
 sub _dump_file_not_like {
-    my $path = shift;
-    open(my $dumpfh, '<', $path) or die "Failed to open '$path': $!";
-    my $contents = do { local $/; <$dumpfh>; };
-    close($dumpfh);
+    my ($path, $contents) = _slurp shift;
     unlike($contents, $_, "$path does not match $_") for @_;
 }