Skip to content

Commit

Permalink
help tests: test --config-for-completion option & output
Browse files Browse the repository at this point in the history
Add a regression test for the --config-for-completion option, this was
tested for indirectly with the test added in 7a09a8f (completion:
add tests for 'git config' completion, 2019-08-13), but let's do it
directly here as well.

Signed-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
  • Loading branch information
avar authored and gitster committed Sep 23, 2021
1 parent d35d03c commit 5a5f04d
Showing 1 changed file with 16 additions and 1 deletion.
17 changes: 16 additions & 1 deletion t/t0012-help.sh
Expand Up @@ -41,7 +41,8 @@ test_expect_success 'invalid usage' '
test_expect_code 129 git help -g add &&
test_expect_code 129 git help -a -g &&
test_expect_code 129 git help -g -c
test_expect_code 129 git help -g -c &&
test_expect_code 0 git help --config-for-completion add
'

test_expect_success "works for commands and guides by default" '
Expand Down Expand Up @@ -96,6 +97,20 @@ test_expect_success 'git help -c' '
test_cmp expect actual
'

test_expect_success 'git help --config-for-completion' '
git help -c >human &&
grep -E \
-e "^[^.]+\.[^.]+$" \
-e "^[^.]+\.[^.]+\.[^.]+$" human |
sed -e "s/\*.*//" -e "s/<.*//" |
sort -u >human.munged &&
git help --config-for-completion >vars &&
sort -u <vars >vars.new &&
mv vars.new vars &&
test_cmp human.munged vars
'

test_expect_success 'generate builtin list' '
git --list-cmds=builtins >builtins
'
Expand Down

0 comments on commit 5a5f04d

Please sign in to comment.