test harness: Fix $skip_test support, broken yesterday.

It was broken by commit e6eea1f9b7,
"test harness: Don't leak options from test files to the test harness.".
This commit is contained in:
Daniel Shahaf 2020-03-18 23:55:10 +00:00
parent 66021cf0f7
commit 63852df983

View File

@ -124,25 +124,26 @@ run_test_internal() {
local -a expected_region_highlight region_highlight local -a expected_region_highlight region_highlight
local ARG="$1" local ARG="$1"
local RETURN=""
() { () {
setopt localoptions setopt localoptions
. "$srcdir"/"$ARG" . "$srcdir"/"$ARG"
# WARNING: The remainder of this anonymous function will run with the test's options in effect # 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; } (( $#skip_test )) && { print -r -- "1..0 # SKIP $skip_test"; return ${RETURN:=0}; }
# Check the data declares $PREBUFFER or $BUFFER. # Check the data declares $PREBUFFER or $BUFFER.
[[ -z $PREBUFFER && -z $BUFFER ]] && { echo >&2 "Bail out! On ${(qq)1}: Either 'PREBUFFER' or 'BUFFER' must be declared and non-blank"; return 1; } [[ -z $PREBUFFER && -z $BUFFER ]] && { echo >&2 "Bail out! On ${(qq)1}: Either 'PREBUFFER' or 'BUFFER' must be declared and non-blank"; return ${RETURN:=1}; }
# Check the data declares $expected_region_highlight. # Check the data declares $expected_region_highlight.
(( $+expected_region_highlight == 0 )) && { echo >&2 "Bail out! On ${(qq)1}: 'expected_region_highlight' is not declared."; return 1; } (( $+expected_region_highlight == 0 )) && { echo >&2 "Bail out! On ${(qq)1}: 'expected_region_highlight' is not declared."; return ${RETURN:=1}; }
# Set sane defaults for ZLE variables # Set sane defaults for ZLE variables
: ${CURSOR=$#BUFFER} ${PENDING=0} ${WIDGET=z-sy-h-test-harness-test-widget} : ${CURSOR=$#BUFFER} ${PENDING=0} ${WIDGET=z-sy-h-test-harness-test-widget}
# Process the data. # Process the data.
_zsh_highlight _zsh_highlight
} }; [[ -z $RETURN ]] || return $RETURN
unset ARG unset ARG
if (( unsorted )); then if (( unsorted )); then