test harness: Fix test failures under zsh 5.0.8 and older.

The output of test-data/opt-shwordsplit1.zsh on zsh 5.7 is:
.
    1..2
    ## opt-shwordsplit1
    # BUFFER=vim
    not ok 1 - [1,7] «$EDITOR» - expected (1 7 "function"), observed (1 7 "unknown-token"). # TODO "issue
    ok 2 - cardinality check # SKIP cardinality check disabled whilst regular test points are expected to fail

On zsh 5.0.8, tap_escape() choked when called on the arguments argv=('[1,7]'
'«vim»').  This patch fixes that.

As you may have noticed, under zsh 5.7 the diagnostic message of test point 1
is truncated.  That'll be fixed in the next commit.
This commit is contained in:
Daniel Shahaf 2020-03-17 16:22:56 +00:00
parent e165f18c75
commit 99389327ae

View file

@ -105,7 +105,7 @@ typeset_p() {
# Escape # as ♯ and newline as ↵ they are illegal in the 'description' part of TAP output
# The string to escape is «"$@"»; the result is returned in $REPLY.
tap_escape() {
local s="$@"
local s="${(j. .)@}"
REPLY="${${s//'#'/♯}//$'\n'/↵}"
}