Skip to content

Commit 8552972

Browse files
peffgitster
authored andcommitted
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 <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent a655a59 commit 8552972

File tree

1 file changed

+3
-5
lines changed

1 file changed

+3
-5
lines changed

t/t3701-add-interactive.sh

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22

33
test_description='add -i basic tests'
44
. ./test-lib.sh
5+
. "$TEST_DIRECTORY"/lib-terminal.sh
56

67
if ! test_have_prereq PERL
78
then
@@ -380,14 +381,11 @@ test_expect_success 'patch mode ignores unmerged entries' '
380381
test_cmp expected diff
381382
'
382383

383-
test_expect_success 'diffs can be colorized' '
384+
test_expect_success TTY 'diffs can be colorized' '
384385
git reset --hard &&
385386
386-
# force color even though the test script has no terminal
387-
test_config color.ui always &&
388-
389387
echo content >test &&
390-
printf y | git add -p >output 2>&1 &&
388+
printf y | test_terminal git add -p >output 2>&1 &&
391389
392390
# We do not want to depend on the exact coloring scheme
393391
# git uses for diffs, so just check that we saw some kind of color.

0 commit comments

Comments
 (0)