test harness: Stringify values in a more readable manner.

(q-) passes through newlines and NUL bytes verbatim.  Using (qqqq) ensures the
escaped string will be on a single line (as required by the TAP format) and be
readable even if it contains control characters.
This commit is contained in:
Daniel Shahaf 2020-03-19 19:15:21 +00:00
parent b0af27f25f
commit 3e7745ef30

View File

@ -95,9 +95,9 @@ ZSH_HIGHLIGHT_HIGHLIGHTERS=($1)
typeset_p() {
for 1 ; do
if [[ ${(tP)1} == *array* ]]; then
print -r -- "$1=( ${(@q-P)1} )"
print -r -- "$1=( ${(@qqqqP)1} )"
else
print -r -- "$1=${(q-P)1}"
print -r -- "$1=${(qqqqP)1}"
fi
done
}