Skip to content

Commit dc70e89

Browse files
committed
tests: Support non-arrays in typeset_p().
1 parent f729726 commit dc70e89

File tree

1 file changed

+7
-3
lines changed

1 file changed

+7
-3
lines changed

tests/test-highlighting.zsh

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -93,9 +93,13 @@ ZSH_HIGHLIGHT_HIGHLIGHTERS=($1)
9393

9494
# In zsh<5.3, 'typeset -p arrayvar' emits two lines, so we use this wrapper instead.
9595
typeset_p() {
96-
for 1 ; do
97-
print -r -- "$1=( ${(@q-P)1} )"
98-
done
96+
for 1 ; do
97+
if [[ ${(tP)1} == *array* ]]; then
98+
print -r -- "$1=( ${(@q-P)1} )"
99+
else
100+
print -r -- "$1=${(q-P)1}"
101+
fi
102+
done
99103
}
100104

101105
# Escape # as ♯ and newline as ↵ they are illegal in the 'description' part of TAP output

0 commit comments

Comments
 (0)