summaryrefslogtreecommitdiff
path: root/t/t3701-add-interactive.sh
diff options
context:
space:
mode:
authorJeff King <peff@peff.net>2017-10-03 13:42:15 (GMT)
committerJunio C Hamano <gitster@pobox.com>2017-10-04 02:32:56 (GMT)
commit8552972b133ee5147f3af11ab21cf4b1d04e97e5 (patch)
tree4f59dc49251c213e1c3c0f0c89dfc5bcc01e7341 /t/t3701-add-interactive.sh
parenta655a595957b873e3fa9f8569568536eb547c4c8 (diff)
downloadgit-8552972b133ee5147f3af11ab21cf4b1d04e97e5.zip
git-8552972b133ee5147f3af11ab21cf4b1d04e97e5.tar.gz
git-8552972b133ee5147f3af11ab21cf4b1d04e97e5.tar.bz2
t3701: use test-terminal to collect color output
When testing whether "add -p" can generate colors, we set color.ui to "always". This isn't a very good test, as in the real-world a user typically has "auto" coupled with stdout going to a terminal (and it's plausible that this could mask a real bug in add--interactive if we depend on plumbing's isatty check). Let's switch to test_terminal, which gives us a more realistic environment. This also prepare us for future changes to the "always" color option. Signed-off-by: Jeff King <peff@peff.net> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 't/t3701-add-interactive.sh')
-rwxr-xr-xt/t3701-add-interactive.sh8
1 files changed, 3 insertions, 5 deletions
diff --git a/t/t3701-add-interactive.sh b/t/t3701-add-interactive.sh
index 2f3e7ce..39d0130 100755
--- a/t/t3701-add-interactive.sh
+++ b/t/t3701-add-interactive.sh
@@ -2,6 +2,7 @@
test_description='add -i basic tests'
. ./test-lib.sh
+. "$TEST_DIRECTORY"/lib-terminal.sh
if ! test_have_prereq PERL
then
@@ -380,14 +381,11 @@ test_expect_success 'patch mode ignores unmerged entries' '
test_cmp expected diff
'
-test_expect_success 'diffs can be colorized' '
+test_expect_success TTY 'diffs can be colorized' '
git reset --hard &&
- # force color even though the test script has no terminal
- test_config color.ui always &&
-
echo content >test &&
- printf y | git add -p >output 2>&1 &&
+ printf y | test_terminal git add -p >output 2>&1 &&
# We do not want to depend on the exact coloring scheme
# git uses for diffs, so just check that we saw some kind of color.