about summary refs log tree commit homepage
path: root/t/git.t
diff options
context:
space:
mode:
authorEric Wong <e@80x24.org>2020-12-27 02:53:04 +0000
committerEric Wong <e@80x24.org>2020-12-28 23:19:48 +0000
commit0f545dd95ca88e69f011aa56d07494887e7df822 (patch)
tree396472716c7ce389a14a04876a42b127fd9593e0 /t/git.t
parent645ec505c03c86ed4500151737bcf3d636d9b18b (diff)
downloadpublic-inbox-0f545dd95ca88e69f011aa56d07494887e7df822.tar.gz
import: check for git->qx errors, clearer return values
Those git commands can fail and git->qx will set $? when it
fails.  There's no need for the extra indirection of the @ret
array, either.

Improve git->qx coverage to check for $? while we're at it.
Diffstat (limited to 't/git.t')
-rw-r--r--t/git.t4
1 files changed, 4 insertions, 0 deletions
diff --git a/t/git.t b/t/git.t
index dcd053c5..2cfff248 100644
--- a/t/git.t
+++ b/t/git.t
@@ -76,13 +76,17 @@ if (1) {
         is(length($$x), $size, 'read correct number of bytes');
 
         my $ref = $gcf->qx(qw(cat-file blob), $buf);
+        is($?, 0, 'no error on scalar success');
         my @ref = $gcf->qx(qw(cat-file blob), $buf);
+        is($?, 0, 'no error on wantarray success');
         my $nl = scalar @ref;
         ok($nl > 1, "qx returned array length of $nl");
         is(join('', @ref), $ref, 'qx array and scalar context both work');
 
         $gcf->qx(qw(repack -adq));
         ok($gcf->packed_bytes > 0, 'packed size is positive');
+        $gcf->qx(qw(rev-parse --verify bogus));
+        isnt($?, 0, '$? set on failure'.$?);
 }
 
 SKIP: {