From dc70e89bfdbed86a0a4c8b2a24416107b948e261 Mon Sep 17 00:00:00 2001 From: Daniel Shahaf Date: Sat, 22 Feb 2020 14:29:55 +0000 Subject: [PATCH] tests: Support non-arrays in typeset_p(). --- tests/test-highlighting.zsh | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/tests/test-highlighting.zsh b/tests/test-highlighting.zsh index b2a6db5..f335293 100755 --- a/tests/test-highlighting.zsh +++ b/tests/test-highlighting.zsh @@ -93,9 +93,13 @@ ZSH_HIGHLIGHT_HIGHLIGHTERS=($1) # In zsh<5.3, 'typeset -p arrayvar' emits two lines, so we use this wrapper instead. typeset_p() { - for 1 ; do - print -r -- "$1=( ${(@q-P)1} )" - done + for 1 ; do + if [[ ${(tP)1} == *array* ]]; then + print -r -- "$1=( ${(@q-P)1} )" + else + print -r -- "$1=${(q-P)1}" + fi + done } # Escape # as ♯ and newline as ↵ they are illegal in the 'description' part of TAP output