summaryrefslogtreecommitdiff
path: root/t/op/dbm.t
diff options
context:
space:
mode:
authorNicholas Clark <nick@ccl4.org>2008-08-07 10:12:44 +0000
committerNicholas Clark <nick@ccl4.org>2008-08-07 10:12:44 +0000
commit1c25d394345c1b97c9cfd949fe3d2e3296fd9681 (patch)
treeeae05365e0036fad7135cb0b5681b1c1fe146571 /t/op/dbm.t
parent748a4b20dad489edbf351cfb9cf18f6da44f79f5 (diff)
downloadperl-1c25d394345c1b97c9cfd949fe3d2e3296fd9681.tar.gz
Use test.pl's tempfile().
p4raw-id: //depot/perl@34180
Diffstat (limited to 't/op/dbm.t')
-rw-r--r--t/op/dbm.t19
1 files changed, 12 insertions, 7 deletions
diff --git a/t/op/dbm.t b/t/op/dbm.t
index e6545fa41b..24033703ba 100644
--- a/t/op/dbm.t
+++ b/t/op/dbm.t
@@ -13,38 +13,43 @@ plan tests => 4;
# This is [20020104.007] "coredump on dbmclose"
+my $filename = tempfile();
+
my $prog = <<'EOC';
package Foo;
+$filename = '@@@@';
sub new {
my $proto = shift;
my $class = ref($proto) || $proto;
my $self = {};
bless($self,$class);
my %LT;
- dbmopen(%LT, "dbmtest", 0666) ||
- die "Can't open dbmtest because of $!\n";
+ dbmopen(%LT, $filename, 0666) ||
+ die "Can't open $filename because of $!\n";
$self->{'LT'} = \%LT;
return $self;
}
sub DESTROY {
my $self = shift;
dbmclose(%{$self->{'LT'}});
- 1 while unlink 'dbmtest';
- 1 while unlink <dbmtest.*>;
+ 1 while unlink $filename;
+ 1 while unlink glob "$filename.*";
print "ok\n";
}
package main;
$test = Foo->new(); # must be package var
EOC
+$prog =~ s/\@\@\@\@/$filename/;
+
fresh_perl_is("require AnyDBM_File;\n$prog", 'ok', {}, 'explict require');
fresh_perl_is($prog, 'ok', {}, 'implicit require');
$prog = <<'EOC';
@INC = ();
-dbmopen(%LT, "dbmtest", 0666);
-1 while unlink 'dbmtest';
-1 while unlink <dbmtest.*>;
+dbmopen(%LT, $filename, 0666);
+1 while unlink $filename;
+1 while unlink glob "$filename.*";
die "Failed to fail!";
EOC