git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Avishay Matayev <me@avishay.dev>
To: git@vger.kernel.org
Cc: code@tpope.net, Avishay Matayev <me@avishay.dev>
Subject: [PATCH 3/3] Add tests for GIT_FORCE_TTY
Date: Wed,  7 Jul 2021 00:03:18 +0300	[thread overview]
Message-ID: <20210706210317.706313-4-me@avishay.dev> (raw)
In-Reply-To: <20210706210317.706313-1-me@avishay.dev>

Signed-off-by: Avishay Matayev <me@avishay.dev>
---
 t/t9904-git-force-tty.sh | 38 ++++++++++++++++++++++++++++++++++++++
 1 file changed, 38 insertions(+)
 create mode 100755 t/t9904-git-force-tty.sh

diff --git a/t/t9904-git-force-tty.sh b/t/t9904-git-force-tty.sh
new file mode 100755
index 0000000000..c954e27c9a
--- /dev/null
+++ b/t/t9904-git-force-tty.sh
@@ -0,0 +1,38 @@
+#!/bin/sh
+
+test_description='Test GIT_FORCE_TTY'
+
+. ./test-lib.sh
+
+test_expect_success 'setup' '
+	echo test_data > test_file &&
+	git add test_file &&
+	git commit -m first
+'
+
+test_expect_success 'no output without force' '
+    GIT_FORCE_TTY=0 GIT_PAGER="cat - > log_data" git log > /dev/null &&
+    test ! -f log_data
+'
+
+test_expect_success 'output with force' '
+    GIT_FORCE_TTY=1 GIT_PAGER="cat - > log_data2" git log > /dev/null &&
+    test -f log_data2
+'
+
+test_expect_success 'cant tell pager present in git reflog without force' '
+    GIT_FORCE_TTY=false PAGER="touch pager2" git reflog > /dev/null &&
+    test ! -f pager2
+'
+
+test_expect_success 'pager present in git reflog' '
+    GIT_FORCE_TTY=yes PAGER="touch pager" git reflog > /dev/null &&
+    test -f pager
+'
+
+test_expect_success 'pager not present in git reflog expire' '
+    GIT_FORCE_TTY=true PAGER="touch pager3" git reflog expire > /dev/null &&
+    test ! -f pager3
+'
+
+test_done
-- 
2.25.1


  parent reply	other threads:[~2021-07-06 21:03 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-07-06 21:03 [PATCH 0/3] Override isatty with GIT_FORCE_TTY Avishay Matayev
2021-07-06 21:03 ` [PATCH 1/3] Change isatty's parameter to a *_FILENO define Avishay Matayev
2021-07-06 21:59   ` Junio C Hamano
2021-07-09 14:41     ` Avishay Matayev
2021-07-06 21:03 ` [PATCH 2/3] Allow isatty to be overriden with GIT_FORCE_TTY Avishay Matayev
2021-07-06 22:03   ` Junio C Hamano
2021-07-09 14:49     ` Avishay Matayev
2021-07-09 17:21       ` Junio C Hamano
2021-07-09 17:24         ` Avishay Matayev
2021-07-09 18:41           ` Junio C Hamano
2021-07-09 19:56             ` Avishay Matayev
2021-07-06 21:03 ` Avishay Matayev [this message]
2021-07-30 12:04 ` [PATCH 0/3] Override isatty " Avishay Matayev

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20210706210317.706313-4-me@avishay.dev \
    --to=me@avishay.dev \
    --cc=code@tpope.net \
    --cc=git@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).