Skip to content

Commit 7a09a8f

Browse files
szedergitster
authored andcommitted
completion: add tests for 'git config' completion
The next patches will change/refactor the way we complete configuration variable names and values, so add a few tests to cover the basics, namely the completion of matching configuration sections, full variable names, and their values. Note that the test checking the completion of configuration sections is currently failing, though it's not a sign of an actual bug. If a section contains multiple variables, then that section is currently repeated as many times as the number of variables in there. This is not a correctness issue in practice, because Bash's completion facilities remove all repetitions anyway. Consequently, we could list all those repeated sections in the expected output of this test as well, but then it would have to be updated whenever a new configuration variable is added to those sections. Instead, list each matching configuration section only once, mark the test as failing for now, and the next patch will update the completion script to avoid those repetitions. Signed-off-by: SZEDER Gábor <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent 840d7e5 commit 7a09a8f

File tree

1 file changed

+21
-0
lines changed

1 file changed

+21
-0
lines changed

t/t9902-completion.sh

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1698,6 +1698,27 @@ do
16981698
'
16991699
done
17001700

1701+
test_expect_failure 'git config - section' '
1702+
test_completion "git config br" <<-\EOF
1703+
branch.Z
1704+
browser.Z
1705+
EOF
1706+
'
1707+
1708+
test_expect_success 'git config - variable name' '
1709+
test_completion "git config log.d" <<-\EOF
1710+
log.date Z
1711+
log.decorate Z
1712+
EOF
1713+
'
1714+
1715+
test_expect_success 'git config - value' '
1716+
test_completion "git config color.pager " <<-\EOF
1717+
false Z
1718+
true Z
1719+
EOF
1720+
'
1721+
17011722
test_expect_success 'sourcing the completion script clears cached commands' '
17021723
__git_compute_all_commands &&
17031724
verbose test -n "$__git_all_commands" &&

0 commit comments

Comments
 (0)