diff options
author | Eric Wong <e@yhbt.net> | 2021-01-17 07:09:58 +0000 |
---|---|---|
committer | Eric Wong <e@80x24.org> | 2021-01-18 09:25:11 +0000 |
commit | 6b498db4b518938e32d7feff85816f3c6dcf3651 (patch) | |
tree | baed8e0f36fb023df9fcca23066b55e96eaeaed3 /t | |
parent | 2d7de5a87e1b4f5a5046161c8fd3b7f0085a5c19 (diff) | |
download | public-inbox-6b498db4b518938e32d7feff85816f3c6dcf3651.tar.gz |
The version of File::Spec shipped with Perl 5.16.3 memoizes the value of File::Spec->tmpdir, causing changes to $ENV{TMPDIR} after-the-fact to be ignored. We'll only work around this in the test since it's innocuous and unlikely to matter in real-world usage (and there's many places where we'd have to workaround this in non-test code).
Diffstat (limited to 't')
-rw-r--r-- | t/shared_kv.t | 10 |
1 files changed, 3 insertions, 7 deletions
diff --git a/t/shared_kv.t b/t/shared_kv.t index e7a8e05e..6f6374f2 100644 --- a/t/shared_kv.t +++ b/t/shared_kv.t @@ -9,9 +9,8 @@ use_ok 'PublicInbox::SharedKV'; my ($tmpdir, $for_destroy) = tmpdir(); local $ENV{TMPDIR} = $tmpdir; my $skv = PublicInbox::SharedKV->new; -opendir(my $dh, $tmpdir) or BAIL_OUT $!; -my @ent = grep(!/\A\.\.?\z/, readdir($dh)); -is(scalar(@ent), 1, 'created a temporary dir'); +my $skv_tmpdir = $skv->{tmpdir}; +ok(-d $skv_tmpdir, 'created a temporary dir'); $skv->dbh; my $dead = "\xde\xad"; my $beef = "\xbe\xef"; @@ -48,10 +47,7 @@ is($skv->delete_by_val($dead), 2, 'delete_by_val hits'); is($skv->delete_by_val($dead), 0, 'delete_by_val misses again'); undef $skv; -rewinddir($dh); -@ent = grep(!/\A\.\.?\z/, readdir($dh)); -is(scalar(@ent), 0, 'temporary dir gone'); -undef $dh; +ok(!-d $skv_tmpdir, 'temporary dir gone'); $skv = PublicInbox::SharedKV->new("$tmpdir/dir", 'base'); ok(-e "$tmpdir/dir/base.sqlite3", 'file created'); |