From 63852df98339a3dd14f122ded3131c41d2fc1b05 Mon Sep 17 00:00:00 2001 From: Daniel Shahaf Date: Wed, 18 Mar 2020 23:55:10 +0000 Subject: [PATCH] test harness: Fix $skip_test support, broken yesterday. It was broken by commit e6eea1f9b7e67136911536a2450c7130f44c0b04, "test harness: Don't leak options from test files to the test harness.". --- tests/test-highlighting.zsh | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/tests/test-highlighting.zsh b/tests/test-highlighting.zsh index e8c36f5..334c447 100755 --- a/tests/test-highlighting.zsh +++ b/tests/test-highlighting.zsh @@ -124,25 +124,26 @@ run_test_internal() { local -a expected_region_highlight region_highlight local ARG="$1" + local RETURN="" () { 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; } + (( $#skip_test )) && { print -r -- "1..0 # SKIP $skip_test"; return ${RETURN:=0}; } # 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. - (( $+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 : ${CURSOR=$#BUFFER} ${PENDING=0} ${WIDGET=z-sy-h-test-harness-test-widget} # Process the data. _zsh_highlight - } + }; [[ -z $RETURN ]] || return $RETURN unset ARG if (( unsorted )); then