test harness: Don't leak options from test files to the test harness.

Fixes an issue whereby the '# TODO "issue #687"' directive in the output of
opt-shwordsplit1.zsh was truncated, because the test itself had set the
SH_WORD_SPLIT option and that affected the evaluation of
«${(z)expected_region_highlight[i]}» in the test harness.

Furthermore, this patch also independently fixes the error under
zsh-5.0.8 and earlier that was fixed by the previous commit.
This commit is contained in:
Daniel Shahaf 2020-03-17 16:35:14 +00:00
parent 99389327ae
commit e6eea1f9b7

View file

@ -123,7 +123,12 @@ run_test_internal() {
local skip_mismatch
local -a expected_region_highlight region_highlight
. "$srcdir"/"$1"
local ARG="$1"
() {
setopt localoptions
. "$srcdir"/"$ARG"
# WARNING: The remainder of this anonymous function will run with the test's options in effect
(( $#skip_test )) && { print -r -- "1..0 # SKIP $skip_test"; return; }
@ -137,6 +142,8 @@ run_test_internal() {
# Process the data.
_zsh_highlight
}
unset ARG
if (( unsorted )); then
region_highlight=("${(@n)region_highlight}")