about summary refs log tree commit homepage
path: root/t/init.t
diff options
context:
space:
mode:
authorEric Wong <e@80x24.org>2018-12-25 03:44:57 +0000
committerEric Wong <e@80x24.org>2018-12-27 23:56:15 +0000
commit4f95d67d882eec0f058dd62ee83e8b9c973f4a26 (patch)
treee634516000ea7321c2a7157c019196c38fc094c8 /t/init.t
parenta34ad831a831600406725e65ededdf2ec96727fc (diff)
downloadpublic-inbox-4f95d67d882eec0f058dd62ee83e8b9c973f4a26.tar.gz
It is redundant to set default values in the public-inbox
config file.  Lets not clutter up users' screens when they
view or edit the config file.
Diffstat (limited to 't/init.t')
-rw-r--r--t/init.t18
1 files changed, 18 insertions, 0 deletions
diff --git a/t/init.t b/t/init.t
index 59f54813..182d065c 100644
--- a/t/init.t
+++ b/t/init.t
@@ -32,6 +32,8 @@ sub quiet_fail {
                    qw(http://example.com/blist blist@example.com));
         is(system(@cmd), 0, 'public-inbox-init OK');
 
+        is(read_indexlevel('blist'), '', 'indexlevel unset by default');
+
         ok(-e $cfgfile, "config exists, now");
         is(system(@cmd), 0, 'public-inbox-init OK (idempotent)');
 
@@ -64,10 +66,26 @@ SKIP: {
         is(system(@cmd), 0, 'public-inbox-init is idempotent');
         ok(! -d "$tmpdir/public-inbox" && !-d "$tmpdir/objects",
                 'idempotent invocation w/o -V2 does not make inbox v1');
+        is(read_indexlevel('v2list'), '', 'indexlevel unset by default');
 
         @cmd = (pi_init, 'v2list', "-V1", "$tmpdir/v2list",
                    qw(http://example.com/v2list v2list@example.com));
         quiet_fail(\@cmd, 'initializing V2 as V1 fails');
+
+        foreach my $lvl (qw(medium basic)) {
+                @cmd = (pi_init, "v2$lvl", '-V2', '-L', $lvl,
+                        "$tmpdir/v2$lvl", "http://example.com/v2$lvl",
+                        "v2$lvl\@example.com");
+                is(system(@cmd), 0, "-init -L $lvl");
+                is(read_indexlevel("v2$lvl"), $lvl, "indexlevel set to '$lvl'");
+        }
 }
 
 done_testing();
+
+sub read_indexlevel {
+        my ($inbox) = @_;
+        local $ENV{GIT_CONFIG} = "$ENV{PI_DIR}/config";
+        chomp(my $lvl = `git config publicinbox.$inbox.indexlevel`);
+        $lvl;
+}