tests: Support non-arrays in typeset_p().

This commit is contained in:
Daniel Shahaf 2020-02-22 14:29:55 +00:00
parent f729726300
commit dc70e89bfd

View File

@ -94,7 +94,11 @@ ZSH_HIGHLIGHT_HIGHLIGHTERS=($1)
# In zsh<5.3, 'typeset -p arrayvar' emits two lines, so we use this wrapper instead. # In zsh<5.3, 'typeset -p arrayvar' emits two lines, so we use this wrapper instead.
typeset_p() { typeset_p() {
for 1 ; do for 1 ; do
if [[ ${(tP)1} == *array* ]]; then
print -r -- "$1=( ${(@q-P)1} )" print -r -- "$1=( ${(@q-P)1} )"
else
print -r -- "$1=${(q-P)1}"
fi
done done
} }