From e433749d86c55af27f762c862dbb06d1e108da13 Mon Sep 17 00:00:00 2001 From: Jeff King Date: Tue, 3 Oct 2017 09:39:34 -0400 Subject: test-terminal: set TERM=vt100 The point of the test-terminal script is to simulate in the test scripts an environment where output is going to a real terminal. But since test-lib.sh also sets TERM=dumb, the simulation isn't very realistic. The color code will skip auto-coloring for TERM=dumb, leading to us liberally sprinkling test_terminal env TERM=vt100 git ... through the test suite to convince the tests to actually generate colors. Let's set TERM for programs run under test_terminal, which is one less thing for test-writers to remember. In most cases the callers can be simplified, but note there is one interesting case in t4202. It uses test_terminal to check the auto-enabling of --decorate, but the expected output _doesn't_ contain colors (because TERM=dumb suppresses them). Using TERM=vt100 is closer to what the real world looks like; adjust the expected output to match. Signed-off-by: Jeff King Signed-off-by: Junio C Hamano --- t/t6006-rev-list-format.sh | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) (limited to 't/t6006-rev-list-format.sh') diff --git a/t/t6006-rev-list-format.sh b/t/t6006-rev-list-format.sh index b326d550f3..98be78b4a2 100755 --- a/t/t6006-rev-list-format.sh +++ b/t/t6006-rev-list-format.sh @@ -229,8 +229,7 @@ do ' test_expect_success TTY "$desc respects --color=auto (stdout is tty)" ' - test_terminal env TERM=vt100 \ - git log --format=$color -1 --color=auto >actual && + test_terminal git log --format=$color -1 --color=auto >actual && has_color actual ' -- cgit v1.2.3 From c5bdfe677cfab5b2e87771c35565d44d3198efda Mon Sep 17 00:00:00 2001 From: Jeff King Date: Tue, 3 Oct 2017 09:44:27 -0400 Subject: t6006: drop "always" color config tests We test the %C() format placeholders with a variety of color-inducing options, including "--color" and "-c color.ui=always". In preparation for the behavior of "always" changing, we need to do something with those "always" tests. We can drop ones that expect "always" to turn on color even to a file, as that will become a synonym for "auto", which is already tested. For the "--no-color" test, we need to make sure that color would otherwise be shown. To do this, we can use test_terminal, which enables colors in the default setup. Signed-off-by: Jeff King Signed-off-by: Junio C Hamano --- t/t6006-rev-list-format.sh | 20 +++++--------------- 1 file changed, 5 insertions(+), 15 deletions(-) (limited to 't/t6006-rev-list-format.sh') diff --git a/t/t6006-rev-list-format.sh b/t/t6006-rev-list-format.sh index 98be78b4a2..25a9c65dc5 100755 --- a/t/t6006-rev-list-format.sh +++ b/t/t6006-rev-list-format.sh @@ -208,26 +208,11 @@ do has_no_color actual ' - test_expect_success "$desc enables colors for color.diff" ' - git -c color.diff=always log --format=$color -1 >actual && - has_color actual - ' - - test_expect_success "$desc enables colors for color.ui" ' - git -c color.ui=always log --format=$color -1 >actual && - has_color actual - ' - test_expect_success "$desc respects --color" ' git log --format=$color -1 --color >actual && has_color actual ' - test_expect_success "$desc respects --no-color" ' - git -c color.ui=always log --format=$color -1 --no-color >actual && - has_no_color actual - ' - test_expect_success TTY "$desc respects --color=auto (stdout is tty)" ' test_terminal git log --format=$color -1 --color=auto >actual && has_color actual @@ -240,6 +225,11 @@ do has_no_color actual ) ' + + test_expect_success TTY "$desc respects --no-color" ' + test_terminal git log --format=$color -1 --no-color >actual && + has_no_color actual + ' done test_expect_success '%C(always,...) enables color even without tty' ' -- cgit v1.2.3