about summary refs log tree commit homepage
path: root/t/git.t
diff options
context:
space:
mode:
Diffstat (limited to 't/git.t')
-rw-r--r--t/git.t23
1 files changed, 23 insertions, 0 deletions
diff --git a/t/git.t b/t/git.t
index d7b20d0d..e7a3c9ea 100644
--- a/t/git.t
+++ b/t/git.t
@@ -139,4 +139,27 @@ if (1) {
         ok($nl > 1, "qx returned array length of $nl");
 }
 
+{
+        my $git = PublicInbox::Git->new($dir);
+
+        my $err = $git->popen([qw(cat-file blob non-existent)], undef,
+                                { 2 => $git->err_begin });
+        my @out = <$err>;
+        my $close_ret = close $err;
+        my $close_err = $?;
+        is(join('', @out), '', 'no output on stdout on error');
+        isnt($close_err, 0, 'close set $? on bad command');
+        ok(!$close_ret, 'close returned error on bad command');
+        isnt($git->err, '', 'got stderr output');
+
+        $err = $git->popen([qw(tag -l)], undef, { 2 => $git->err_begin });
+        @out = <$err>;
+        $close_ret = close $err;
+        $close_err = $?;
+        is(join('', @out), '', 'no output on stdout on error');
+        ok(!$close_err, 'close clobbered $? on empty output');
+        ok($close_ret, 'close returned error on empty output');
+        is($git->err, '', 'no stderr output');
+}
+
 done_testing();