Ensure schema files are generated as binary files on Windows
[dbsrgits/DBIx-Class-Schema-Loader.git] / t / lib / dbixcsl_dumper_tests.pm
index d16a3bb..0382c0c 100644 (file)
@@ -210,19 +210,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 @_;
 }