Skip to content

Commit 1739303

Browse files
felipecgitster
authored andcommitted
completion: simplify __gitcomp() test helper
By using print_comp as suggested by SZEDER Gábor. Signed-off-by: Felipe Contreras <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent e461523 commit 1739303

File tree

1 file changed

+5
-10
lines changed

1 file changed

+5
-10
lines changed

t/t9902-completion.sh

Lines changed: 5 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -70,23 +70,18 @@ test_completion ()
7070
test_cmp expected out
7171
}
7272

73-
newline=$'\n'
74-
7573
# Test __gitcomp.
7674
# The first argument is the typed text so far (cur); the rest are
7775
# passed to __gitcomp. Expected output comes is read from the
7876
# standard input, like test_completion().
7977
test_gitcomp ()
8078
{
79+
local -a COMPREPLY &&
8180
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 &&
9085
test_cmp expected out
9186
}
9287

0 commit comments

Comments
 (0)