summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorÆvar Arnfjörð Bjarmason <avarab@gmail.com>2021-09-21 22:40:37 (GMT)
committerJunio C Hamano <gitster@pobox.com>2021-09-23 17:30:43 (GMT)
commit5a5f04d86b870bfec1c8cfefa8207a4e110fa128 (patch)
treedc2a18e09c6038b39812ceecb02d600b2a5b3f5c
parentd35d03cf93ef0dba3e975c78fce73db91d52ba42 (diff)
downloadgit-5a5f04d86b870bfec1c8cfefa8207a4e110fa128.zip
git-5a5f04d86b870bfec1c8cfefa8207a4e110fa128.tar.gz
git-5a5f04d86b870bfec1c8cfefa8207a4e110fa128.tar.bz2
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 7a09a8f093e (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>
-rwxr-xr-xt/t0012-help.sh17
1 files changed, 16 insertions, 1 deletions
diff --git a/t/t0012-help.sh b/t/t0012-help.sh
index 69e385d..25bbaf0 100755
--- a/t/t0012-help.sh
+++ b/t/t0012-help.sh
@@ -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" '
@@ -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
'