mirror of
https://github.com/git/git.git
synced 2024-10-19 09:28:35 +02:00
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>
This commit is contained in:
parent
e461523892
commit
173930330a
@ -70,23 +70,18 @@ test_completion ()
|
|||||||
test_cmp expected out
|
test_cmp expected out
|
||||||
}
|
}
|
||||||
|
|
||||||
newline=$'\n'
|
|
||||||
|
|
||||||
# Test __gitcomp.
|
# Test __gitcomp.
|
||||||
# The first argument is the typed text so far (cur); the rest are
|
# The first argument is the typed text so far (cur); the rest are
|
||||||
# passed to __gitcomp. Expected output comes is read from the
|
# passed to __gitcomp. Expected output comes is read from the
|
||||||
# standard input, like test_completion().
|
# standard input, like test_completion().
|
||||||
test_gitcomp ()
|
test_gitcomp ()
|
||||||
{
|
{
|
||||||
|
local -a COMPREPLY &&
|
||||||
sed -e 's/Z$//' >expected &&
|
sed -e 's/Z$//' >expected &&
|
||||||
(
|
cur="$1" &&
|
||||||
local -a COMPREPLY &&
|
shift &&
|
||||||
cur="$1" &&
|
__gitcomp "$@" &&
|
||||||
shift &&
|
print_comp &&
|
||||||
__gitcomp "$@" &&
|
|
||||||
IFS="$newline" &&
|
|
||||||
echo "${COMPREPLY[*]}" >out
|
|
||||||
) &&
|
|
||||||
test_cmp expected out
|
test_cmp expected out
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user