about summary refs log tree commit homepage
path: root/t
diff options
context:
space:
mode:
authorEric Wong <e@80x24.org>2023-11-28 14:56:23 +0000
committerEric Wong <e@80x24.org>2023-11-29 02:13:23 +0000
commitc76a20d75200630b0b5072e4ce39651230f8cabe (patch)
treeb8af35b864d4acfd943de791cd8cd9d89654b3c4 /t
parent46c08b706123b79c7884d1cbd3252a7bd93b885e (diff)
downloadpublic-inbox-c76a20d75200630b0b5072e4ce39651230f8cabe.tar.gz
Accepting @ARGV without switches ends up being ambiguous with
optional parameters for --join and --show.  Requiring users to
specify `--join=' or `--show=' is a bit awkward (as it with
-clone --objstore= and the like, but that is historical baggage
we need to carry at this point...)
Diffstat (limited to 't')
-rw-r--r--t/cindex-join.t7
-rw-r--r--t/cindex.t9
-rw-r--r--t/xap_helper.t4
3 files changed, 13 insertions, 7 deletions
diff --git a/t/cindex-join.t b/t/cindex-join.t
index ac90cd64..c2e85332 100644
--- a/t/cindex-join.t
+++ b/t/cindex-join.t
@@ -70,7 +70,7 @@ my $cidxdir = "$tmpdir/cidx";
 my $rdr = { 1 => \my $cout, 2 => \my $cerr };
 ok run_script([qw(-cindex -v --all --show=join_data),
                 '--join=aggressive,dt:..2022-12-01',
-                '-d', $cidxdir, values %code ],
+                '-d', $cidxdir, map { ('-g', $_) } values %code ],
                 $env, $rdr), 'initial join inboxes w/ coderepos';
 my $out = PublicInbox::Config->json->decode($cout);
 is($out->{join_data}->{dt}->[0], '19700101'.'000000',
@@ -79,4 +79,9 @@ is($out->{join_data}->{dt}->[0], '19700101'.'000000',
 ok run_script([qw(-cindex -v --all -u --join --show),
                 '-d', $cidxdir], $env, $rdr), 'incremental --join';
 
+ok run_script([qw(-cindex -v --no-scan --show),
+                '-d', $cidxdir], $env, $rdr), 'show';
+$out = PublicInbox::Config->json->decode($cout);
+is ref($out->{join_data}), 'HASH', 'got hash join data';
+is $cerr, '', 'no warnings or errors in stderr w/ --show';
 done_testing;
diff --git a/t/cindex.t b/t/cindex.t
index 29d88ca8..0193cf18 100644
--- a/t/cindex.t
+++ b/t/cindex.t
@@ -33,7 +33,7 @@ git gc -q
 EOM
 }; # /create_coderepo
 
-ok(run_script([qw(-cindex --dangerous -q), "$tmp/wt0"]), 'cindex internal');
+ok(run_script([qw(-cindex --dangerous -q -g), "$tmp/wt0"]), 'cindex internal');
 {
         my $exists = -e "$tmp/wt0/.git/public-inbox-cindex/cidx.lock";
         my @st = stat(_);
@@ -67,13 +67,14 @@ git gc -q
 EOM
 }; # /create_coderepo
 
-ok(run_script([qw(-cindex --dangerous -q -d), "$tmp/ext", $zp, "$tmp/wt0"]),
+ok(run_script([qw(-cindex --dangerous -q -d), "$tmp/ext",
+                '-g', $zp, '-g', "$tmp/wt0" ]),
         'cindex external');
 ok(-e "$tmp/ext/cidx.lock", 'external dir created');
 ok(!-d "$zp/.git/public-inbox-cindex", 'no cindex in original coderepo');
 
 ok(run_script([qw(-cindex -L medium --dangerous -q -d),
-        "$tmp/med", $zp, "$tmp/wt0"]), 'cindex external medium');
+        "$tmp/med", '-g', $zp, '-g', "$tmp/wt0"]), 'cindex external medium');
 
 
 SKIP: {
@@ -228,7 +229,7 @@ SKIP: { # --prune
 
 File::Path::remove_tree("$tmp/ext");
 mkdir("$tmp/ext", 0707);
-ok(run_script([qw(-cindex --dangerous -q -d), "$tmp/ext", $zp]),
+ok(run_script([qw(-cindex --dangerous -q -d), "$tmp/ext", '-g', $zp]),
         'external on existing dir');
 {
         my @st = stat("$tmp/ext/cidx.lock");
diff --git a/t/xap_helper.t b/t/xap_helper.t
index ee25b2dc..37679ae9 100644
--- a/t/xap_helper.t
+++ b/t/xap_helper.t
@@ -20,10 +20,10 @@ my $crepo = create_coderepo 'for-cindex', sub {
         xsys_e([qw(git init -q --bare)]);
         xsys_e([qw(git fast-import --quiet)], undef, { 0 => $fi_fh });
         chdir($dh);
-        run_script([qw(-cindex --dangerous -L medium --no-fsync -q -j1), $d])
+        run_script([qw(-cindex --dangerous -L medium --no-fsync -q -j1), '-g', $d])
                 or xbail '-cindex internal';
         run_script([qw(-cindex --dangerous -L medium --no-fsync -q -j3 -d),
-                "$d/cidx-ext", $d]) or xbail '-cindex "external"';
+                "$d/cidx-ext", '-g', $d]) or xbail '-cindex "external"';
 };
 $dh = $fi_fh = undef;