From f6f7a918187900bb3d84cc260951ed43f234317f Mon Sep 17 00:00:00 2001 From: Daniel Shahaf Date: Thu, 11 Jun 2020 08:09:45 +0000 Subject: [PATCH] test harness: Fix use of an undefined variable in an error message. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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". --- tests/test-highlighting.zsh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/test-highlighting.zsh b/tests/test-highlighting.zsh index 74ccc95..c30d571 100755 --- a/tests/test-highlighting.zsh +++ b/tests/test-highlighting.zsh @@ -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}