completion: simplify __gitcomp() test helper
By using print_comp as suggested by SZEDER Gábor. Signed-off-by: Felipe Contreras <felipe.contreras@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Felipe Contreras committed
Nov 11, 2012 at 15:35 UTC
173930330ad039d8c09b821001abd95d040a2832
1 file changed
+5
-10
t/t9902-completion.sh
+5
-10
@@ -70,23 +70,18 @@ test_completion ()
70
test_cmp expected out
71
}
72
73
-newline=$'\n'
74
-
73
# Test __gitcomp.
74
# The first argument is the typed text so far (cur); the rest are
75
# passed to __gitcomp. Expected output comes is read from the
76
# standard input, like test_completion().
77
test_gitcomp ()
78
{
79
+ local -a COMPREPLY &&
80
sed -e 's/Z$//' >expected &&
82
- (
83
- local -a COMPREPLY &&
84
- cur="$1" &&
85
- shift &&
86
- __gitcomp "$@" &&
87
- IFS="$newline" &&
88
- echo "${COMPREPLY[*]}" >out
89
- ) &&
81
+ cur="$1" &&
82
+ shift &&
83
+ __gitcomp "$@" &&
84
+ print_comp &&
85
test_cmp expected out
86
}
87