зеркало из https://github.com/microsoft/git.git
t7508: use test_terminal for color output
This script tests the output of status with various formats when color is enabled. It uses the "always" setting so that the output is valid even though we capture it in a file. Using test_terminal gives us a more realistic environment, and prepares us for the behavior of "always" changing. Arguably we are testing less than before, since "auto" is already the default, and we can no longer tell if the config is actually doing anything. Signed-off-by: Jeff King <peff@peff.net> Signed-off-by: Junio C Hamano <gitster@pobox.com>
This commit is contained in:
Родитель
8552972b13
Коммит
01c94e9001
|
@ -6,6 +6,7 @@
|
|||
test_description='git status'
|
||||
|
||||
. ./test-lib.sh
|
||||
. "$TEST_DIRECTORY"/lib-terminal.sh
|
||||
|
||||
test_expect_success 'status -h in broken repository' '
|
||||
git config --global advice.statusuoption false &&
|
||||
|
@ -667,7 +668,7 @@ test_expect_success 'setup unique colors' '
|
|||
|
||||
'
|
||||
|
||||
test_expect_success 'status with color.ui' '
|
||||
test_expect_success TTY 'status with color.ui' '
|
||||
cat >expect <<\EOF &&
|
||||
On branch <GREEN>master<RESET>
|
||||
Your branch and '\''upstream'\'' have diverged,
|
||||
|
@ -694,14 +695,14 @@ Untracked files:
|
|||
<BLUE>untracked<RESET>
|
||||
|
||||
EOF
|
||||
test_config color.ui always &&
|
||||
git status | test_decode_color >output &&
|
||||
test_config color.ui auto &&
|
||||
test_terminal git status | test_decode_color >output &&
|
||||
test_i18ncmp expect output
|
||||
'
|
||||
|
||||
test_expect_success 'status with color.status' '
|
||||
test_config color.status always &&
|
||||
git status | test_decode_color >output &&
|
||||
test_expect_success TTY 'status with color.status' '
|
||||
test_config color.status auto &&
|
||||
test_terminal git status | test_decode_color >output &&
|
||||
test_i18ncmp expect output
|
||||
'
|
||||
|
||||
|
@ -714,19 +715,19 @@ cat >expect <<\EOF
|
|||
<BLUE>??<RESET> untracked
|
||||
EOF
|
||||
|
||||
test_expect_success 'status -s with color.ui' '
|
||||
test_expect_success TTY 'status -s with color.ui' '
|
||||
|
||||
git config color.ui always &&
|
||||
git status -s | test_decode_color >output &&
|
||||
git config color.ui auto &&
|
||||
test_terminal git status -s | test_decode_color >output &&
|
||||
test_cmp expect output
|
||||
|
||||
'
|
||||
|
||||
test_expect_success 'status -s with color.status' '
|
||||
test_expect_success TTY 'status -s with color.status' '
|
||||
|
||||
git config --unset color.ui &&
|
||||
git config color.status always &&
|
||||
git status -s | test_decode_color >output &&
|
||||
git config color.status auto &&
|
||||
test_terminal git status -s | test_decode_color >output &&
|
||||
test_cmp expect output
|
||||
|
||||
'
|
||||
|
@ -741,9 +742,9 @@ cat >expect <<\EOF
|
|||
<BLUE>??<RESET> untracked
|
||||
EOF
|
||||
|
||||
test_expect_success 'status -s -b with color.status' '
|
||||
test_expect_success TTY 'status -s -b with color.status' '
|
||||
|
||||
git status -s -b | test_decode_color >output &&
|
||||
test_terminal git status -s -b | test_decode_color >output &&
|
||||
test_i18ncmp expect output
|
||||
|
||||
'
|
||||
|
@ -757,20 +758,20 @@ A dir2/added
|
|||
?? untracked
|
||||
EOF
|
||||
|
||||
test_expect_success 'status --porcelain ignores color.ui' '
|
||||
test_expect_success TTY 'status --porcelain ignores color.ui' '
|
||||
|
||||
git config --unset color.status &&
|
||||
git config color.ui always &&
|
||||
git status --porcelain | test_decode_color >output &&
|
||||
git config color.ui auto &&
|
||||
test_terminal git status --porcelain | test_decode_color >output &&
|
||||
test_cmp expect output
|
||||
|
||||
'
|
||||
|
||||
test_expect_success 'status --porcelain ignores color.status' '
|
||||
test_expect_success TTY 'status --porcelain ignores color.status' '
|
||||
|
||||
git config --unset color.ui &&
|
||||
git config color.status always &&
|
||||
git status --porcelain | test_decode_color >output &&
|
||||
git config color.status auto &&
|
||||
test_terminal git status --porcelain | test_decode_color >output &&
|
||||
test_cmp expect output
|
||||
|
||||
'
|
||||
|
|
Загрузка…
Ссылка в новой задаче