about summary refs log tree commit homepage
path: root/t
diff options
context:
space:
mode:
authorEric Wong <e@80x24.org>2016-12-12 12:02:45 +0000
committerEric Wong <e@80x24.org>2016-12-12 12:04:23 +0000
commit3043725a10eae59a71c25ba5e4d424a49326afd7 (patch)
tree6d18b1c384c087ed29a6f74a57a8aa5611889c4b /t
parent53e8cfbe4e06e5ae6ad61fb7e9bd45804c253a72 (diff)
downloadpublic-inbox-3043725a10eae59a71c25ba5e4d424a49326afd7.tar.gz
This matches git-config(1) behavior, and implied user
intent when it comes to programatically editing files.
Diffstat (limited to 't')
-rw-r--r--t/init.t10
1 files changed, 8 insertions, 2 deletions
diff --git a/t/init.t b/t/init.t
index b78fbaf5..f87dc225 100644
--- a/t/init.t
+++ b/t/init.t
@@ -13,10 +13,16 @@ use constant pi_init => 'blib/script/public-inbox-init';
         my $cfgfile = "$ENV{PI_DIR}/config";
         my @cmd = (pi_init, 'blist', "$tmpdir/blist",
                    qw(http://example.com/blist blist@example.com));
-        is(system(@cmd), 0, 'public-inbox-init failed');
+        is(system(@cmd), 0, 'public-inbox-init OK');
 
         ok(-e $cfgfile, "config exists, now");
-        is(system(@cmd), 0, 'public-inbox-init failed (idempotent)');
+        is(system(@cmd), 0, 'public-inbox-init OK (idempotent)');
+
+        chmod 0666, $cfgfile or die "chmod failed: $!";
+        @cmd = (pi_init, 'clist', "$tmpdir/clist",
+                   qw(http://example.com/clist clist@example.com));
+        is(system(@cmd), 0, 'public-inbox-init clist OK');
+        is((stat($cfgfile))[2] & 07777, 0666, "permissions preserved");
 }
 
 done_testing();