summaryrefslogtreecommitdiff
path: root/t/lib-terminal.sh
diff options
context:
space:
mode:
authorJeff King <peff@peff.net>2010-10-17 02:36:57 +0800
committerJunio C Hamano <gitster@pobox.com>2010-10-18 16:20:19 -0700
commite23f436c35c3e7fd12feeed783064e08aaf27869 (patch)
tree666f29eb3bfa3aa18981af1b0c23f79dbf1b56de /t/lib-terminal.sh
parentcc4e48fc1eafdb9bec037f10c22708a26fd25ef6 (diff)
downloadgit-e23f436c35c3e7fd12feeed783064e08aaf27869.tar.gz
tests: test terminal output to both stdout and stderr
Some outputs (like the pager) care whether stdout is a terminal. Others (like progress meters) care about stderr. This patch sets up both. Technically speaking, we could go further and set up just one (because either the other goes to a terminal, or because our tests are only interested in one). This patch does both to keep the interface to lib-terminal simple. Signed-off-by: Jeff King <peff@peff.net> Reviewed-by: Jonathan Nieder <jrnieder@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 't/lib-terminal.sh')
-rw-r--r--t/lib-terminal.sh8
1 files changed, 4 insertions, 4 deletions
diff --git a/t/lib-terminal.sh b/t/lib-terminal.sh
index 6fc33db6c1..3258b8f0d5 100644
--- a/t/lib-terminal.sh
+++ b/t/lib-terminal.sh
@@ -1,19 +1,19 @@
#!/bin/sh
test_expect_success 'set up terminal for tests' '
- if test -t 1
+ if test -t 1 && test -t 2
then
- >stdout_is_tty
+ >have_tty
elif
test_have_prereq PERL &&
"$PERL_PATH" "$TEST_DIRECTORY"/test-terminal.perl \
- sh -c "test -t 1"
+ sh -c "test -t 1 && test -t 2"
then
>test_terminal_works
fi
'
-if test -e stdout_is_tty
+if test -e have_tty
then
test_terminal() { "$@"; }
test_set_prereq TTY