aboutsummaryrefslogtreecommitdiff
path: root/t/t9902-completion.sh
diff options
context:
space:
mode:
authorFelipe Contreras <felipe.contreras@gmail.com>2012-11-11 15:35:58 +0100
committerJunio C Hamano <gitster@pobox.com>2012-11-16 11:18:53 -0800
commit173930330ad039d8c09b821001abd95d040a2832 (patch)
tree38f5c7e30b267b579d70663f6e49c3236a60f35c /t/t9902-completion.sh
parente461523892440f378dd7d872cac9fc6094c6492c (diff)
downloadgit-173930330ad039d8c09b821001abd95d040a2832.tar.gz
git-173930330ad039d8c09b821001abd95d040a2832.tar.xz
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>
Diffstat (limited to 't/t9902-completion.sh')
-rwxr-xr-xt/t9902-completion.sh15
1 files changed, 5 insertions, 10 deletions
diff --git a/t/t9902-completion.sh b/t/t9902-completion.sh
index f754de312..96542b5c5 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
}