From 173930330ad039d8c09b821001abd95d040a2832 Mon Sep 17 00:00:00 2001 From: Felipe Contreras Date: Sun, 11 Nov 2012 15:35:58 +0100 Subject: [PATCH] completion: simplify __gitcomp() test helper MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit By using print_comp as suggested by SZEDER Gábor. Signed-off-by: Felipe Contreras Signed-off-by: Junio C Hamano --- t/t9902-completion.sh | 15 +++++---------- 1 file changed, 5 insertions(+), 10 deletions(-) diff --git a/t/t9902-completion.sh b/t/t9902-completion.sh index f754de3122..96542b5c52 100755 --- a/t/t9902-completion.sh +++ b/t/t9902-completion.sh @@ -70,23 +70,18 @@ test_completion () test_cmp expected out } -newline=$'\n' - # Test __gitcomp. # The first argument is the typed text so far (cur); the rest are # passed to __gitcomp. Expected output comes is read from the # standard input, like test_completion(). test_gitcomp () { + local -a COMPREPLY && sed -e 's/Z$//' >expected && - ( - local -a COMPREPLY && - cur="$1" && - shift && - __gitcomp "$@" && - IFS="$newline" && - echo "${COMPREPLY[*]}" >out - ) && + cur="$1" && + shift && + __gitcomp "$@" && + print_comp && test_cmp expected out }