Re: [PATCH 2/7] completion: fix args of run_completion() test helper

2012-11-18 Thread Felipe Contreras
On Sat, Nov 17, 2012 at 12:05 PM, SZEDER Gábor sze...@ira.uka.de wrote:

  test_expect_success 'basic' '
 -   run_completion git \\ 
 +   run_completion git  

I don't like this approach. I prefer

run_completion git 

So that it's similar to how test_completion is called:

run_completion git f
test_completion git f

-- 
Felipe Contreras
--
To unsubscribe from this list: send the line unsubscribe git in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 2/7] completion: fix args of run_completion() test helper

2012-11-17 Thread SZEDER Gábor
To simulate that the user hit 'git TAB, the 'basic' test sets up the
rather strange command line containing the two words

  git 

i.e. the second word on the command line consists of two double
quotes.  This is not what happens for real, however, because after
'git TAB' the second word on the command line is just an empty
string.  Luckily, the test works nevertheless.

Fix this by passing the command line to run_completion() as separate
words.

Signed-off-by: SZEDER Gábor sze...@ira.uka.de
---
 t/t9902-completion.sh | 8 
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/t/t9902-completion.sh b/t/t9902-completion.sh
index b56759f7..3af75872 100755
--- a/t/t9902-completion.sh
+++ b/t/t9902-completion.sh
@@ -49,7 +49,7 @@ run_completion ()
 {
local -a COMPREPLY _words
local _cword
-   _words=( $1 )
+   _words=( $@ )
(( _cword = ${#_words[@]} - 1 ))
__git_wrap__git_main  print_comp
 }
@@ -57,7 +57,7 @@ run_completion ()
 test_completion ()
 {
test $# -gt 1  echo $2  expected
-   run_completion $@ 
+   run_completion $1 
test_cmp expected out
 }
 
@@ -156,7 +156,7 @@ test_expect_success '__gitcomp - suffix' '
 '
 
 test_expect_success 'basic' '
-   run_completion git \\ 
+   run_completion git  
# built-in
echo add  expected 
sed -n /^add \$/p out out2 
@@ -170,7 +170,7 @@ test_expect_success 'basic' '
sed -n /^ls-files \$/p out out2 
test_cmp expected out2 
 
-   run_completion git f 
+   run_completion git f 
expected 
sed -n /^[^f]/p out out2 
test_cmp expected out2
-- 
1.8.0.220.g4d14ece

--
To unsubscribe from this list: send the line unsubscribe git in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH 2/7] completion: fix args of run_completion() test helper

2012-11-17 Thread Jonathan Nieder
SZEDER Gábor wrote:

 Fix this by passing the command line to run_completion() as separate
 words.

Good catch.  The change makes sense, the code looks saner after the
fix, and since this is test code any breakage should be caught
quickly, so

Reviewed-by: Jonathan Nieder jrnie...@gmail.com

Thanks.
--
To unsubscribe from this list: send the line unsubscribe git in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html