From 30d8f92df2258c263185ede09925fef3fa47019c Mon Sep 17 00:00:00 2001 From: Daniel Shahaf Date: Wed, 20 Jan 2016 22:01:45 +0000 Subject: [PATCH] test harness: Properly quote error message interpolations. No functional change, except that error messages are now more readable. --- tests/test-highlighting.zsh | 6 +++--- tests/test-perfs.zsh | 4 ++-- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/tests/test-highlighting.zsh b/tests/test-highlighting.zsh index dc47989..5c2741d 100755 --- a/tests/test-highlighting.zsh +++ b/tests/test-highlighting.zsh @@ -37,13 +37,13 @@ # Check the highlighter is valid. [[ -f ${0:h:h}/highlighters/$1/$1-highlighter.zsh ]] || { - echo >&2 "Bail out! Could not find highlighter '$1'." + echo >&2 "Bail out! Could not find highlighter ${(qq)1}." exit 2 } # Check the highlighter has test data. [[ -d ${0:h:h}/highlighters/$1/test-data ]] || { - echo >&2 "Bail out! Highlighter '$1' has no test data." + echo >&2 "Bail out! Highlighter ${(qq)1} has no test data." exit 2 } @@ -104,7 +104,7 @@ run_test_internal() { [[ -n "$highlight_zone[4]" ]] && todo=" # TODO $highlight_zone[4]" for j in {$highlight_zone[1]..$highlight_zone[2]}; do if [[ "$observed_result[$j]" != "$highlight_zone[3]" ]]; then - echo "not ok $i '$BUFFER[$highlight_zone[1],$highlight_zone[2]]' [$highlight_zone[1],$highlight_zone[2]]: expected '$highlight_zone[3]', observed '$observed_result[$j]'.$todo" + echo "not ok $i ${(qqq)BUFFER[$highlight_zone[1],$highlight_zone[2]]} [$highlight_zone[1],$highlight_zone[2]]: expected ${(qqq)highlight_zone[3]}, observed ${(qqq)observed_result[$j]}.$todo" continue 2 fi done diff --git a/tests/test-perfs.zsh b/tests/test-perfs.zsh index 45a800b..5d94b37 100755 --- a/tests/test-perfs.zsh +++ b/tests/test-perfs.zsh @@ -37,13 +37,13 @@ # Check the highlighter is valid. [[ -f ${0:h:h}/highlighters/$1/$1-highlighter.zsh ]] || { - echo >&2 "Bail out! Could not find highlighter '$1'." + echo >&2 "Bail out! Could not find highlighter ${(qq)1}." exit 2 } # Check the highlighter has test data. [[ -d ${0:h:h}/highlighters/$1/test-data ]] || { - echo >&2 "Bail out! Highlighter '$1' has no test data." + echo >&2 "Bail out! Highlighter ${(qq)1} has no test data." exit 2 }