about summary refs log tree commit homepage
path: root/t/init.t
diff options
context:
space:
mode:
authorEric Wong <e@yhbt.net>2020-07-26 09:03:15 +0000
committerEric Wong <e@yhbt.net>2020-07-26 23:46:37 +0000
commit999e8c1b3d54f4504cd4fa87949a077da325a1af (patch)
treeeec5c3b9db9a742c182769a74bb70e3f30368049 /t/init.t
parentc3ba74805e58b006768f3a29c3688a0a1d0bacaf (diff)
downloadpublic-inbox-999e8c1b3d54f4504cd4fa87949a077da325a1af.tar.gz
Tests for failures should not leave junk temporary files lying
around in a users' ~/.public-inbox/.

On a side note, I'm not sure if PI_DIR is or was ever
necessary.  It's never been documented, so perhaps
using $HOME for this is better...
Diffstat (limited to 't/init.t')
-rw-r--r--t/init.t5
1 files changed, 4 insertions, 1 deletions
diff --git a/t/init.t b/t/init.t
index b8f17b5c..16581955 100644
--- a/t/init.t
+++ b/t/init.t
@@ -50,12 +50,15 @@ sub quiet_fail {
                 '-init did not unlink lock on failure');
 }
 {
+        my $env = { PI_DIR => "$tmpdir/.public-inbox/" };
         my $rdr = { 2 => \(my $err = '') };
         my $cmd = [ '-init', 'alist', "$tmpdir/a\nlist",
                    qw(http://example.com/alist alist@example.com) ];
-        ok(!run_script($cmd, undef, $rdr),
+        ok(!run_script($cmd, $env, $rdr),
                 'public-inbox-init rejects LF in inboxdir');
         like($err, qr/`\\n' not allowed in `/s, 'reported \\n');
+        is_deeply([glob("$tmpdir/.public-inbox/pi-init-*")], [],
+                'no junk files left behind');
 }
 
 SKIP: {