test harness: Fix use of an undefined variable in an error message.

The error message uses «$1», but it is always unset at that point.
Furthermore, the NO_UNSET (-u) option is in effect.  Therefore, when the
error message was to be printed, zsh's NO_UNSET error message was
printed instead:
.
    (anon):20: 1: parameter not set

That error message was printed to stderr, and was caught by the caller
within the test harness:
.
    Bail out! On './highlighters/main/test-data/path_prefix3.zsh': output on stderr

Thus, the bug being fixed would not caused false positive or false
negative test results, but only wrong error messages.

Follow-up to 0.7.1-71-ge6eea1f, "test harness: Don't leak options from
test files to the test harness".
This commit is contained in:
Daniel Shahaf 2020-06-11 08:09:45 +00:00
parent 6fd92e1bbd
commit f6f7a91818

View file

@ -144,7 +144,7 @@ run_test_internal() {
}
# 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 ${RETURN:=1}; }
[[ -z $PREBUFFER && -z $BUFFER ]] && { echo >&2 "Bail out! On ${(qq)ARG}: Either 'PREBUFFER' or 'BUFFER' must be declared and non-blank"; return ${RETURN:=1}; }
# Set sane defaults for ZLE variables
: ${CURSOR=$#BUFFER} ${PENDING=0} ${WIDGET=z-sy-h-test-harness-test-widget}