Skip to content

Commit 5a5f04d

Browse files
avargitster
authored andcommitted
help tests: test --config-for-completion option & output
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 <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent d35d03c commit 5a5f04d

File tree

1 file changed

+16
-1
lines changed

1 file changed

+16
-1
lines changed

t/t0012-help.sh

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,8 @@ test_expect_success 'invalid usage' '
4141
test_expect_code 129 git help -g add &&
4242
test_expect_code 129 git help -a -g &&
4343
44-
test_expect_code 129 git help -g -c
44+
test_expect_code 129 git help -g -c &&
45+
test_expect_code 0 git help --config-for-completion add
4546
'
4647

4748
test_expect_success "works for commands and guides by default" '
@@ -96,6 +97,20 @@ test_expect_success 'git help -c' '
9697
test_cmp expect actual
9798
'
9899

100+
test_expect_success 'git help --config-for-completion' '
101+
git help -c >human &&
102+
grep -E \
103+
-e "^[^.]+\.[^.]+$" \
104+
-e "^[^.]+\.[^.]+\.[^.]+$" human |
105+
sed -e "s/\*.*//" -e "s/<.*//" |
106+
sort -u >human.munged &&
107+
108+
git help --config-for-completion >vars &&
109+
sort -u <vars >vars.new &&
110+
mv vars.new vars &&
111+
test_cmp human.munged vars
112+
'
113+
99114
test_expect_success 'generate builtin list' '
100115
git --list-cmds=builtins >builtins
101116
'

0 commit comments

Comments
 (0)