tests: Fix the test for alias loops.

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".
This commit is contained in:
Daniel Shahaf 2020-03-15 17:07:27 +00:00
parent 525ba90932
commit 9931990b92

View File

@ -28,12 +28,16 @@
# vim: ft=zsh sw=2 ts=2 et # vim: ft=zsh sw=2 ts=2 et
# ------------------------------------------------------------------------------------------------- # -------------------------------------------------------------------------------------------------
function b() {} # beware of ALIAS_FUNC_DEF
alias a=b b=c c=b alias a=b b=c c=b
BUFFER='a foo; :' BUFFER='a foo; :'
expected_region_highlight=( 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 '3 5 default' # foo
'6 6 commandseparator' # ; '6 6 commandseparator' # ;
'8 8 builtin' # : '8 8 builtin' # :