This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
pp_leavesub(): call FREETMPS and optimise
[perl5.git] / t / op / dbm.t
index 9e81f59..6c51dad 100644 (file)
@@ -1,7 +1,7 @@
 #!./perl
 
 BEGIN {
-    chdir 't';
+    chdir 't' if -d 't';
     @INC = '../lib';
     require './test.pl';
 
@@ -62,6 +62,11 @@ fresh_perl_like('delete $::{"AnyDBM_File::"}; ' . $prog,
 { # undef 3rd arg
     local $^W = 1;
     local $SIG{__WARN__} = sub { ++$w };
-    dbmopen(%truffe, 'pleaseletthisfilenotexist', undef);
+    # Files may get created as a side effect of dbmopen, so ensure cleanup.
+    my $leaf = 'pleaseletthisfilenotexist';
+    dbmopen(%truffe, $leaf, undef);
     is $w, 1, '1 warning from dbmopen with undef third arg';
+    unlink $leaf
+        if -e $leaf;
+    1 while unlink glob "$leaf.*";
 }