From 9931990b92a276c6ec69cdf6af9f9f3b65603cd1 Mon Sep 17 00:00:00 2001 From: Daniel Shahaf Date: Sun, 15 Mar 2020 17:07:27 +0000 Subject: [PATCH] tests: Fix the test for alias loops. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Before this commit, the command word was highlighted as "unknown-token" not because alias loops are invalid, as a comment incorrectly claimed, but because the command word «a» resolved to a «b» that was ineligible for being expanded as an alias, and there was no function/builtin/etc. called "b". Add a function "b" to demonstrate that alias loops are valid. I've also filed issue #695 about the overloading of "unknown-token". --- highlighters/main/test-data/alias-loop.zsh | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/highlighters/main/test-data/alias-loop.zsh b/highlighters/main/test-data/alias-loop.zsh index baa122b..83992db 100644 --- a/highlighters/main/test-data/alias-loop.zsh +++ b/highlighters/main/test-data/alias-loop.zsh @@ -28,12 +28,16 @@ # vim: ft=zsh sw=2 ts=2 et # ------------------------------------------------------------------------------------------------- +function b() {} # beware of ALIAS_FUNC_DEF alias a=b b=c c=b BUFFER='a foo; :' expected_region_highlight=( - '1 1 unknown-token' # a (invalid alias loop) + # An alias is ineligible for expansion whilst it's being expanded. + # Therefore, the "b" in the expansion of the alias "c" is not considered + # as an alias. + '1 1 alias' # a '3 5 default' # foo '6 6 commandseparator' # ; '8 8 builtin' # :