test harness: Properly quote error message interpolations.

No functional change, except that error messages are now more readable.
This commit is contained in:
Daniel Shahaf 2016-01-20 22:01:45 +00:00
parent 282c7134e8
commit 30d8f92df2
2 changed files with 5 additions and 5 deletions

View file

@ -37,13 +37,13 @@
# Check the highlighter is valid. # Check the highlighter is valid.
[[ -f ${0:h:h}/highlighters/$1/$1-highlighter.zsh ]] || { [[ -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 exit 2
} }
# Check the highlighter has test data. # Check the highlighter has test data.
[[ -d ${0:h:h}/highlighters/$1/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 exit 2
} }
@ -104,7 +104,7 @@ run_test_internal() {
[[ -n "$highlight_zone[4]" ]] && todo=" # TODO $highlight_zone[4]" [[ -n "$highlight_zone[4]" ]] && todo=" # TODO $highlight_zone[4]"
for j in {$highlight_zone[1]..$highlight_zone[2]}; do for j in {$highlight_zone[1]..$highlight_zone[2]}; do
if [[ "$observed_result[$j]" != "$highlight_zone[3]" ]]; then 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 continue 2
fi fi
done done

View file

@ -37,13 +37,13 @@
# Check the highlighter is valid. # Check the highlighter is valid.
[[ -f ${0:h:h}/highlighters/$1/$1-highlighter.zsh ]] || { [[ -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 exit 2
} }
# Check the highlighter has test data. # Check the highlighter has test data.
[[ -d ${0:h:h}/highlighters/$1/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 exit 2
} }