From c9d1993dc8eb7b7c99dabfe6d72dd580a57a7875 Mon Sep 17 00:00:00 2001 From: Ingo Karkat Date: Wed, 22 Feb 2012 08:43:47 +0100 Subject: [PATCH] test-lib: Avoid empty line in diff when no completion. There should be a trailing newline when there are completions (to avoid diff complaining about "no trailing newline", but not when there are no completions at all. --- tests/test-lib.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tests/test-lib.sh b/tests/test-lib.sh index fefab5b..8947e38 100644 --- a/tests/test-lib.sh +++ b/tests/test-lib.sh @@ -660,8 +660,8 @@ test_todo_completion () { _todo IFS=$'\n' - printf '%s\n' "${EXPECT[*]}" > expect - printf '%s\n' "${COMPREPLY[*]}" > output + printf "%s${EXPECT:+\\n}" "${EXPECT[*]}" > expect + printf "%s${COMPREPLY:+\\n}" "${COMPREPLY[*]}" > output IFS=$SAVEIFS if [ ${#COMPREPLY[@]} -eq ${#EXPECT[@]} ]