completion: trivial test improvement

Instead of passing a dummy "", let's check if the last character is a space, and then move the _cword accordingly. Apparently we were passing "" all the way to compgen, which fortunately expanded it to nothing. Lets do the right thing though. Signed-off-by: Felipe Contreras <felipe.contreras@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>

Felipe Contreras committed Apr 10, 2013 at 01:57 UTC cdbff7d6ad3c1c3e8c9dbd1cbd5c43fa240982be
1 file changed +2 -1
t/t9902-completion.sh
+2 -1
@@ -69,6 +69,7 @@ run_completion ()
69 local -a COMPREPLY _words
70 local _cword
71 _words=( $1 )
72 + test "${1: -1}" == ' ' && _words+=('')
73 (( _cword = ${#_words[@]} - 1 ))
74 __git_wrap__git_main && print_comp
75 }
@@ -148,7 +149,7 @@ test_expect_success '__gitcomp - suffix' '
149 '
150
151 test_expect_success 'basic' '
151 - run_completion "git \"\"" &&
152 + run_completion "git " &&
153 # built-in
154 grep -q "^add \$" out &&
155 # script