tests: Use $unused_highlight in more places.

Notably, the 'single-hyphen-option' and 'assign' contexts both default to the
'none' style, so before this patch, the tests would not have detected a failure
to apply those two contexts.

For other contexts, using $unused_highlight only helps detect the case where
the right highlight style (e.g., 'fg=yellow') is used as a result of applying
the wrong context — which should be a theoretical failure mode.

This is part of zsh-users/zsh-syntax-highlighting#198.
This commit is contained in:
Daniel Shahaf 2015-09-18 18:44:18 +00:00
parent 00862cf4fa
commit 627eb71940
5 changed files with 5 additions and 0 deletions

View File

@ -28,6 +28,7 @@
# vim: ft=zsh sw=2 ts=2 et
# -------------------------------------------------------------------------------------------------
ZSH_HIGHLIGHT_STYLES[assign]=$unused_highlight
BUFFER='a+=(lorem ipsum)'
expected_region_highlight=(

View File

@ -28,6 +28,7 @@
# vim: ft=zsh sw=2 ts=2 et
# -------------------------------------------------------------------------------------------------
ZSH_HIGHLIGHT_STYLES[assign]=$unused_highlight
BUFFER='A=1 b=("foo" bar)'
expected_region_highlight=(

View File

@ -28,6 +28,7 @@
# vim: ft=zsh sw=2 ts=2 et
# -------------------------------------------------------------------------------------------------
ZSH_HIGHLIGHT_STYLES[dollar-quoted-argument]=$unused_highlight
BUFFER=": \$'*'"
expected_region_highlight=(

View File

@ -28,6 +28,7 @@
# vim: ft=zsh sw=2 ts=2 et
# -------------------------------------------------------------------------------------------------
ZSH_HIGHLIGHT_STYLES[double-quoted-argument]=$unused_highlight
BUFFER=$'echo "foo1\n'
expected_region_highlight=(

View File

@ -28,6 +28,7 @@
# vim: ft=zsh sw=2 ts=2 et
# -------------------------------------------------------------------------------------------------
ZSH_HIGHLIGHT_STYLES[single-hyphen-option]=$unused_highlight
BUFFER='sudo -u otheruser ls /'
expected_region_highlight=(