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 c9add50..6c51dad 100644 (file)
@@ -1,7 +1,7 @@
 #!./perl
 
 BEGIN {
-    chdir 't';
+    chdir 't' if -d 't';
     @INC = '../lib';
     require './test.pl';
 
@@ -9,7 +9,7 @@ BEGIN {
     skip_all("No dbm functions") if $@;
 }
 
-plan tests => 4;
+plan tests => 5;
 
 # This is [20020104.007] "coredump on dbmclose"
 
@@ -58,3 +58,15 @@ fresh_perl_like($prog, qr/No dbm on this machine/, {},
 fresh_perl_like('delete $::{"AnyDBM_File::"}; ' . $prog,
                qr/No dbm on this machine/, {},
                'implicit require and no stash fails');
+
+{ # undef 3rd arg
+    local $^W = 1;
+    local $SIG{__WARN__} = sub { ++$w };
+    # 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.*";
+}