about summary refs log tree commit homepage
path: root/t
diff options
context:
space:
mode:
authorEric Wong <e@80x24.org>2021-03-28 09:01:18 +0000
committerEric Wong <e@80x24.org>2021-03-28 23:01:37 +0000
commitd41790d816a48c314a1443e1430d56366758ae0a (patch)
tree93b858035bb2b096b0dba57b7497ebf7eabe589d /t
parentc9095090b9056892266621839ad3f456606b882e (diff)
downloadpublic-inbox-d41790d816a48c314a1443e1430d56366758ae0a.tar.gz
Most of it already gets tested since most of the logic is in
SolverGit, but make sure it's all wired up properly to lei.
Diffstat (limited to 't')
-rw-r--r--t/solver_git.t21
1 files changed, 20 insertions, 1 deletions
diff --git a/t/solver_git.t b/t/solver_git.t
index 7bf3ba21..6d4b93c7 100644
--- a/t/solver_git.t
+++ b/t/solver_git.t
@@ -29,6 +29,7 @@ my $ibx = create_inbox 'v2', version => 2,
 my $v1_0_0_tag = 'cb7c42b1e15577ed2215356a2bf925aef59cdd8d';
 my $v1_0_0_tag_short = substr($v1_0_0_tag, 0, 16);
 my $expect = '69df7d565d49fbaaeb0a067910f03dc22cd52bd0';
+my $non_existent = 'ee5e32211bf62ab6531bdf39b84b6920d0b6775a';
 
 test_lei({tmpdir => $tmpdir}, sub {
         lei_ok('blob', '69df7d5', '-I', $ibx->{inboxdir});
@@ -37,6 +38,25 @@ test_lei({tmpdir => $tmpdir}, sub {
         my $prev = $lei_out;
         lei_ok(qw(blob --no-mail 69df7d5 -I), $ibx->{inboxdir});
         is($lei_out, $prev, '--no-mail works');
+        ok(!lei(qw(blob -I), $ibx->{inboxdir}, $non_existent),
+                        'non-existent blob fails');
+        SKIP: {
+                skip '/.git exists', 1 if -e '/.git';
+                require PublicInbox::OnDestroy;
+                opendir my $dh, '.' or xbail "opendir: $!";
+                my $end = PublicInbox::OnDestroy->new($$, sub {
+                        chdir $dh or xbail "chdir: $!";
+                });
+                lei_ok(qw(-C / blob 69df7d5 -I), $ibx->{inboxdir},
+                        "--git-dir=$git_dir");
+                is($lei_out, $prev, '--git-dir works');
+
+                ok(!lei(qw(-C / blob --no-cwd 69df7d5 -I), $ibx->{inboxdir}),
+                        '--no-cwd works');
+
+                ok(!lei(qw(-C / blob -I), $ibx->{inboxdir}, $non_existent),
+                        'non-existent blob fails');
+        }
 
         # fallbacks
         lei_ok('blob', $v1_0_0_tag, '-I', $ibx->{inboxdir});
@@ -163,7 +183,6 @@ EOF
         close $cfgfh or die;
         my $cfg = PublicInbox::Config->new($cfgpath);
         my $www = PublicInbox::WWW->new($cfg);
-        my $non_existent = 'ee5e32211bf62ab6531bdf39b84b6920d0b6775a';
         my $client = sub {
                 my ($cb) = @_;
                 my $mid = '20190401081523.16213-1-BOFH@YHBT.net';