Converted all relevant tests to use new_dbm instead of new_fh and all tests (except...
[dbsrgits/DBM-Deep.git] / t / 13_setpack.t
index fe8be0f..aac1735 100644 (file)
@@ -1,9 +1,8 @@
-##
-# DBM::Deep Test
-##
 use strict;
+use warnings FATAL => 'all';
+
 use Config;
-use Test::More tests => 10;
+use Test::More;
 use t::common qw( new_fh );
 
 use_ok( 'DBM::Deep' );
@@ -18,7 +17,7 @@ my ($default, $small, $medium, $large);
     );
     $db->{key1} = "value1";
     $db->{key2} = "value2";
-    $default = (stat($db->_fh()))[7];
+    $default = (stat($filename))[7];
 }
 
 {
@@ -32,7 +31,7 @@ my ($default, $small, $medium, $large);
 
         $db->{key1} = "value1";
         $db->{key2} = "value2";
-        $medium = (stat($db->_fh()))[7];
+        $medium = (stat($filename))[7];
     }
 
     # This tests the header to verify that the pack_size is really there
@@ -59,7 +58,7 @@ my ($default, $small, $medium, $large);
 
         $db->{key1} = "value1";
         $db->{key2} = "value2";
-        $small = (stat($db->_fh()))[7];
+        $small = (stat($filename))[7];
     }
 
     # This tests the header to verify that the pack_size is really there
@@ -75,9 +74,12 @@ my ($default, $small, $medium, $large);
     cmp_ok( $medium, '>', $small, "medium is greater than small" );
 }
 
+eval "pack('Q', 0);";
+my $haveQ = !$@;
+
 SKIP: {
     skip "Largefile support is not compiled into $^X", 3
-        if 1; #unless $Config{ uselargefile };
+        unless $haveQ;
 
     my ($fh, $filename) = new_fh();
     {
@@ -89,7 +91,7 @@ SKIP: {
 
         $db->{key1} = "value1";
         $db->{key2} = "value2";
-        $large = (stat($db->_fh()))[7];
+        $large = (stat($filename))[7];
     }
 
     # This tests the header to verify that the pack_size is really there
@@ -103,3 +105,20 @@ SKIP: {
     }
     cmp_ok( $medium, '<', $large, "medium is smaller than large" );
 }
+
+#SKIP: {
+#    skip "Largefile support is compiled into $^X", 3
+#        if $haveQ;
+#
+#    my ($fh, $filename) = new_fh();
+#    {
+#        my $db = DBM::Deep->new(
+#            file => $filename,
+#            autoflush => 1,
+#            pack_size => 'large',
+#        );
+#    }
+#
+#}
+
+done_testing;