Fix for [RT #32462]: avoid leading temp files around
[dbsrgits/DBM-Deep.git] / t / 27_filehandle.t
index 11f9eca..be5f58c 100644 (file)
@@ -1,7 +1,8 @@
-##
-# DBM::Deep Test
-##
+use 5.006_000;
+
 use strict;
+use warnings FATAL => 'all';
+
 use Test::More tests => 14;
 use Test::Exception;
 use t::common qw( new_fh );
@@ -30,8 +31,12 @@ use_ok( 'DBM::Deep' );
         } qr/Cannot write to a readonly filehandle/, "Can't write to a read-only filehandle";
         ok( !$db->exists( 'foo' ), "foo doesn't exist" );
 
-        my $db_obj = $db->_get_self;
-        ok( $db_obj->_storage->{inode}, "The inode has been set" );
+        SKIP: {
+            skip( "No inode tests on Win32", 1 )
+                if ( $^O eq 'MSWin32' || $^O eq 'cygwin' );
+            my $db_obj = $db->_get_self;
+            ok( $db_obj->_engine->storage->{inode}, "The inode has been set" );
+        }
 
         close($fh);
     }
@@ -45,7 +50,7 @@ use_ok( 'DBM::Deep' );
     print $fh "#!$^X\n";
     print $fh <<'__END_FH__';
 use strict;
-use Test::More no_plan => 1;
+use Test::More 'no_plan';
 Test::More->builder->no_ending(1);
 Test::More->builder->{Curr_Test} = 12;
 
@@ -56,6 +61,14 @@ my $db = DBM::Deep->new({
 });
 is($db->{x}, 'b', "and get at stuff in the database");
 __END_FH__
+
+    # The exec below prevents END blocks from doing this.
+    (my $esc_dir = $t::common::dir) =~ s/(.)/sprintf "\\x{%x}", ord $1/egg;
+    print $fh <<__END_FH_AGAIN__;
+use File::Path 'rmtree';
+rmtree "$esc_dir"; 
+__END_FH_AGAIN__
+
     print $fh "__DATA__\n";
     close $fh;