tests: Remove unused_highlight
This commit is contained in:
parent
fd061b5730
commit
d3678ec7a8
@ -30,7 +30,6 @@
|
|||||||
# Issue #263 (more-pathological case): aliases[x=y]=z works; the ${(z)} splitter considers
|
# Issue #263 (more-pathological case): aliases[x=y]=z works; the ${(z)} splitter considers
|
||||||
# that a single word; but it's not looked up as an alias. Hence, highlight it as an error.
|
# that a single word; but it's not looked up as an alias. Hence, highlight it as an error.
|
||||||
aliases[x=y]='lorem ipsum dolor sit amet'
|
aliases[x=y]='lorem ipsum dolor sit amet'
|
||||||
ZSH_HIGHLIGHT_STYLES[alias]=$unused_highlight
|
|
||||||
BUFFER='x=y ls'
|
BUFFER='x=y ls'
|
||||||
|
|
||||||
expected_region_highlight=(
|
expected_region_highlight=(
|
||||||
|
@ -31,7 +31,6 @@ alias alias1="unused expansion"
|
|||||||
alias -s alias2="echo"
|
alias -s alias2="echo"
|
||||||
alias1() {} # to check that it's highlighted as an alias, not as a function
|
alias1() {} # to check that it's highlighted as an alias, not as a function
|
||||||
|
|
||||||
ZSH_HIGHLIGHT_STYLES[alias]=$unused_highlight
|
|
||||||
BUFFER='x.alias2; alias1'
|
BUFFER='x.alias2; alias1'
|
||||||
|
|
||||||
# Set expected_region_highlight as a function of zsh version.
|
# Set expected_region_highlight as a function of zsh version.
|
||||||
|
@ -27,7 +27,6 @@
|
|||||||
# vim: ft=zsh sw=2 ts=2 et
|
# vim: ft=zsh sw=2 ts=2 et
|
||||||
# -------------------------------------------------------------------------------------------------
|
# -------------------------------------------------------------------------------------------------
|
||||||
|
|
||||||
ZSH_HIGHLIGHT_STYLES[assign]=$unused_highlight
|
|
||||||
BUFFER='a+=(lorem ipsum)'
|
BUFFER='a+=(lorem ipsum)'
|
||||||
|
|
||||||
expected_region_highlight=(
|
expected_region_highlight=(
|
||||||
|
@ -27,7 +27,6 @@
|
|||||||
# vim: ft=zsh sw=2 ts=2 et
|
# vim: ft=zsh sw=2 ts=2 et
|
||||||
# -------------------------------------------------------------------------------------------------
|
# -------------------------------------------------------------------------------------------------
|
||||||
|
|
||||||
ZSH_HIGHLIGHT_STYLES[assign]=$unused_highlight
|
|
||||||
BUFFER='(A=(hello world))'
|
BUFFER='(A=(hello world))'
|
||||||
|
|
||||||
expected_region_highlight=(
|
expected_region_highlight=(
|
||||||
|
@ -27,7 +27,6 @@
|
|||||||
# vim: ft=zsh sw=2 ts=2 et
|
# vim: ft=zsh sw=2 ts=2 et
|
||||||
# -------------------------------------------------------------------------------------------------
|
# -------------------------------------------------------------------------------------------------
|
||||||
|
|
||||||
ZSH_HIGHLIGHT_STYLES[commandseparator]=$unused_highlight
|
|
||||||
BUFFER='A=1; echo hello world'
|
BUFFER='A=1; echo hello world'
|
||||||
|
|
||||||
expected_region_highlight=(
|
expected_region_highlight=(
|
||||||
|
@ -27,7 +27,6 @@
|
|||||||
# vim: ft=zsh sw=2 ts=2 et
|
# vim: ft=zsh sw=2 ts=2 et
|
||||||
# -------------------------------------------------------------------------------------------------
|
# -------------------------------------------------------------------------------------------------
|
||||||
|
|
||||||
ZSH_HIGHLIGHT_STYLES[assign]=$unused_highlight
|
|
||||||
BUFFER='(A=1)'
|
BUFFER='(A=1)'
|
||||||
|
|
||||||
expected_region_highlight=(
|
expected_region_highlight=(
|
||||||
|
@ -27,7 +27,6 @@
|
|||||||
# vim: ft=zsh sw=2 ts=2 et
|
# vim: ft=zsh sw=2 ts=2 et
|
||||||
# -------------------------------------------------------------------------------------------------
|
# -------------------------------------------------------------------------------------------------
|
||||||
|
|
||||||
ZSH_HIGHLIGHT_STYLES[assign]=$unused_highlight
|
|
||||||
BUFFER='A=1 b=("foo" bar)'
|
BUFFER='A=1 b=("foo" bar)'
|
||||||
|
|
||||||
expected_region_highlight=(
|
expected_region_highlight=(
|
||||||
|
@ -27,7 +27,6 @@
|
|||||||
# vim: ft=zsh sw=2 ts=2 et
|
# vim: ft=zsh sw=2 ts=2 et
|
||||||
# -------------------------------------------------------------------------------------------------
|
# -------------------------------------------------------------------------------------------------
|
||||||
|
|
||||||
ZSH_HIGHLIGHT_STYLES[back-quoted-argument]=$unused_highlight
|
|
||||||
BUFFER='echo `echo 42`'
|
BUFFER='echo `echo 42`'
|
||||||
|
|
||||||
expected_region_highlight=(
|
expected_region_highlight=(
|
||||||
|
@ -27,8 +27,6 @@
|
|||||||
# vim: ft=zsh sw=2 ts=2 et
|
# vim: ft=zsh sw=2 ts=2 et
|
||||||
# -------------------------------------------------------------------------------------------------
|
# -------------------------------------------------------------------------------------------------
|
||||||
|
|
||||||
ZSH_HIGHLIGHT_STYLES[commandseparator]=$unused_highlight
|
|
||||||
|
|
||||||
BUFFER=':; pwd &! ls'
|
BUFFER=':; pwd &! ls'
|
||||||
|
|
||||||
expected_region_highlight=(
|
expected_region_highlight=(
|
||||||
|
@ -27,7 +27,6 @@
|
|||||||
# vim: ft=zsh sw=2 ts=2 et
|
# vim: ft=zsh sw=2 ts=2 et
|
||||||
# -------------------------------------------------------------------------------------------------
|
# -------------------------------------------------------------------------------------------------
|
||||||
|
|
||||||
ZSH_HIGHLIGHT_STYLES[alias]=$unused_highlight
|
|
||||||
BUFFER='while if echo Hello; then ls /; else ls; fi; do stat "x"; done; repeat 10 ls'
|
BUFFER='while if echo Hello; then ls /; else ls; fi; do stat "x"; done; repeat 10 ls'
|
||||||
|
|
||||||
expected_region_highlight+=(
|
expected_region_highlight+=(
|
||||||
|
@ -27,7 +27,6 @@
|
|||||||
# vim: ft=zsh sw=2 ts=2 et
|
# vim: ft=zsh sw=2 ts=2 et
|
||||||
# -------------------------------------------------------------------------------------------------
|
# -------------------------------------------------------------------------------------------------
|
||||||
|
|
||||||
ZSH_HIGHLIGHT_STYLES[dollar-quoted-argument]=$unused_highlight
|
|
||||||
BUFFER=": \$'*' 'foo'"
|
BUFFER=": \$'*' 'foo'"
|
||||||
|
|
||||||
expected_region_highlight=(
|
expected_region_highlight=(
|
||||||
|
@ -27,7 +27,6 @@
|
|||||||
# vim: ft=zsh sw=2 ts=2 et
|
# vim: ft=zsh sw=2 ts=2 et
|
||||||
# -------------------------------------------------------------------------------------------------
|
# -------------------------------------------------------------------------------------------------
|
||||||
|
|
||||||
ZSH_HIGHLIGHT_STYLES[back-dollar-quoted-argument]=$unused_highlight
|
|
||||||
BUFFER=": \$'foo\xbar\udeadbeef\uzzzz'"
|
BUFFER=": \$'foo\xbar\udeadbeef\uzzzz'"
|
||||||
|
|
||||||
expected_region_highlight=(
|
expected_region_highlight=(
|
||||||
|
@ -28,7 +28,6 @@
|
|||||||
# -------------------------------------------------------------------------------------------------
|
# -------------------------------------------------------------------------------------------------
|
||||||
|
|
||||||
# Similar to double-quoted2.zsh
|
# Similar to double-quoted2.zsh
|
||||||
ZSH_HIGHLIGHT_STYLES[back-dollar-quoted-argument]=$unused_highlight
|
|
||||||
# This test checks that the '1' gets highlighted correctly. Do not append to the BUFFER.
|
# This test checks that the '1' gets highlighted correctly. Do not append to the BUFFER.
|
||||||
BUFFER=": \$'\xa1"
|
BUFFER=": \$'\xa1"
|
||||||
|
|
||||||
|
@ -27,7 +27,6 @@
|
|||||||
# vim: ft=zsh sw=2 ts=2 et
|
# vim: ft=zsh sw=2 ts=2 et
|
||||||
# -------------------------------------------------------------------------------------------------
|
# -------------------------------------------------------------------------------------------------
|
||||||
|
|
||||||
ZSH_HIGHLIGHT_STYLES[double-hyphen-option]=$unused_highlight
|
|
||||||
BUFFER='hello --world'
|
BUFFER='hello --world'
|
||||||
|
|
||||||
expected_region_highlight=(
|
expected_region_highlight=(
|
||||||
|
@ -27,7 +27,6 @@
|
|||||||
# vim: ft=zsh sw=2 ts=2 et
|
# vim: ft=zsh sw=2 ts=2 et
|
||||||
# -------------------------------------------------------------------------------------------------
|
# -------------------------------------------------------------------------------------------------
|
||||||
|
|
||||||
ZSH_HIGHLIGHT_STYLES[redirection]=$unused_highlight
|
|
||||||
BUFFER='exec {foo}>&/tmp ls'
|
BUFFER='exec {foo}>&/tmp ls'
|
||||||
|
|
||||||
expected_region_highlight=(
|
expected_region_highlight=(
|
||||||
|
@ -27,7 +27,6 @@
|
|||||||
# vim: ft=zsh sw=2 ts=2 et
|
# vim: ft=zsh sw=2 ts=2 et
|
||||||
# -------------------------------------------------------------------------------------------------
|
# -------------------------------------------------------------------------------------------------
|
||||||
|
|
||||||
ZSH_HIGHLIGHT_STYLES[function]=$unused_highlight
|
|
||||||
cd() {
|
cd() {
|
||||||
builtin cd "$@"
|
builtin cd "$@"
|
||||||
}
|
}
|
||||||
@ -36,8 +35,6 @@ ls() {
|
|||||||
}
|
}
|
||||||
BUFFER='cd;ls'
|
BUFFER='cd;ls'
|
||||||
|
|
||||||
# Use $unused_highlight to see that function highlighting has precedence over command and builtin
|
|
||||||
|
|
||||||
expected_region_highlight=(
|
expected_region_highlight=(
|
||||||
"1 2 function" # cd
|
"1 2 function" # cd
|
||||||
"4 5 function" # ls
|
"4 5 function" # ls
|
||||||
|
@ -28,7 +28,6 @@
|
|||||||
# -------------------------------------------------------------------------------------------------
|
# -------------------------------------------------------------------------------------------------
|
||||||
|
|
||||||
hash zsh_syntax_highlighting_hash=/doesnotexist
|
hash zsh_syntax_highlighting_hash=/doesnotexist
|
||||||
ZSH_HIGHLIGHT_STYLES[hashed-command]=$unused_highlight
|
|
||||||
BUFFER='zsh_syntax_highlighting_hash'
|
BUFFER='zsh_syntax_highlighting_hash'
|
||||||
|
|
||||||
expected_region_highlight=(
|
expected_region_highlight=(
|
||||||
|
@ -27,7 +27,6 @@
|
|||||||
# vim: ft=zsh sw=2 ts=2 et
|
# vim: ft=zsh sw=2 ts=2 et
|
||||||
# -------------------------------------------------------------------------------------------------
|
# -------------------------------------------------------------------------------------------------
|
||||||
|
|
||||||
ZSH_HIGHLIGHT_STYLES[default]=$unused_highlight
|
|
||||||
BUFFER='!foo bar !baz ! ; !'
|
BUFFER='!foo bar !baz ! ; !'
|
||||||
|
|
||||||
expected_region_highlight=(
|
expected_region_highlight=(
|
||||||
|
@ -27,7 +27,6 @@
|
|||||||
# vim: ft=zsh sw=2 ts=2 et
|
# vim: ft=zsh sw=2 ts=2 et
|
||||||
# -------------------------------------------------------------------------------------------------
|
# -------------------------------------------------------------------------------------------------
|
||||||
|
|
||||||
ZSH_HIGHLIGHT_STYLES[double-quoted-argument]=$unused_highlight
|
|
||||||
BUFFER=$'echo "foo1\n'
|
BUFFER=$'echo "foo1\n'
|
||||||
|
|
||||||
expected_region_highlight=(
|
expected_region_highlight=(
|
||||||
|
@ -30,7 +30,6 @@
|
|||||||
# Assumes that '/bin/sh' exists and '/bin/s' does not exist.
|
# Assumes that '/bin/sh' exists and '/bin/s' does not exist.
|
||||||
# Related to path_prefix2.zsh
|
# Related to path_prefix2.zsh
|
||||||
|
|
||||||
ZSH_HIGHLIGHT_STYLES[path_prefix]=$unused_highlight
|
|
||||||
BUFFER='ls /bin/s'
|
BUFFER='ls /bin/s'
|
||||||
|
|
||||||
expected_region_highlight=(
|
expected_region_highlight=(
|
||||||
|
@ -30,7 +30,6 @@
|
|||||||
# Assumes that '/bin/sh' exists and '/bin/s' does not exist.
|
# Assumes that '/bin/sh' exists and '/bin/s' does not exist.
|
||||||
# Related to path_prefix.zsh
|
# Related to path_prefix.zsh
|
||||||
|
|
||||||
ZSH_HIGHLIGHT_STYLES[path_prefix]=$unused_highlight
|
|
||||||
BUFFER='ls /bin/s'
|
BUFFER='ls /bin/s'
|
||||||
WIDGET=accept-line
|
WIDGET=accept-line
|
||||||
|
|
||||||
|
@ -27,7 +27,6 @@
|
|||||||
# vim: ft=zsh sw=2 ts=2 et
|
# vim: ft=zsh sw=2 ts=2 et
|
||||||
# -------------------------------------------------------------------------------------------------
|
# -------------------------------------------------------------------------------------------------
|
||||||
|
|
||||||
ZSH_HIGHLIGHT_STYLES[assign]=$unused_highlight
|
|
||||||
BUFFER=': command zzzzzz'
|
BUFFER=': command zzzzzz'
|
||||||
|
|
||||||
expected_region_highlight=(
|
expected_region_highlight=(
|
||||||
|
@ -28,7 +28,6 @@
|
|||||||
# -------------------------------------------------------------------------------------------------
|
# -------------------------------------------------------------------------------------------------
|
||||||
|
|
||||||
# Redirection before and after the command word are implemented differently; test both.
|
# Redirection before and after the command word are implemented differently; test both.
|
||||||
ZSH_HIGHLIGHT_STYLES[redirection]=$unused_highlight
|
|
||||||
BUFFER='<<<foo echo >>&!bar'
|
BUFFER='<<<foo echo >>&!bar'
|
||||||
|
|
||||||
expected_region_highlight=(
|
expected_region_highlight=(
|
||||||
|
@ -27,7 +27,6 @@
|
|||||||
# vim: ft=zsh sw=2 ts=2 et
|
# vim: ft=zsh sw=2 ts=2 et
|
||||||
# -------------------------------------------------------------------------------------------------
|
# -------------------------------------------------------------------------------------------------
|
||||||
|
|
||||||
ZSH_HIGHLIGHT_STYLES[reserved-word]=$unused_highlight
|
|
||||||
BUFFER='repeat "1" do done'
|
BUFFER='repeat "1" do done'
|
||||||
|
|
||||||
expected_region_highlight=(
|
expected_region_highlight=(
|
||||||
|
@ -27,7 +27,6 @@
|
|||||||
# vim: ft=zsh sw=2 ts=2 et
|
# vim: ft=zsh sw=2 ts=2 et
|
||||||
# -------------------------------------------------------------------------------------------------
|
# -------------------------------------------------------------------------------------------------
|
||||||
|
|
||||||
ZSH_HIGHLIGHT_STYLES[single-hyphen-option]=$unused_highlight
|
|
||||||
# Tests three codepaths:
|
# Tests three codepaths:
|
||||||
# * -i (no argument)
|
# * -i (no argument)
|
||||||
# * -C3 (pasted argument)
|
# * -C3 (pasted argument)
|
||||||
|
@ -27,7 +27,6 @@
|
|||||||
# vim: ft=zsh sw=2 ts=2 et
|
# vim: ft=zsh sw=2 ts=2 et
|
||||||
# -------------------------------------------------------------------------------------------------
|
# -------------------------------------------------------------------------------------------------
|
||||||
|
|
||||||
ZSH_HIGHLIGHT_STYLES[single-hyphen-option]=$unused_highlight
|
|
||||||
setopt interactive_comments
|
setopt interactive_comments
|
||||||
BUFFER='sudo -u # comment'
|
BUFFER='sudo -u # comment'
|
||||||
|
|
||||||
|
@ -27,7 +27,6 @@
|
|||||||
# vim: ft=zsh sw=2 ts=2 et
|
# vim: ft=zsh sw=2 ts=2 et
|
||||||
# -------------------------------------------------------------------------------------------------
|
# -------------------------------------------------------------------------------------------------
|
||||||
|
|
||||||
ZSH_HIGHLIGHT_STYLES[redirection]=$unused_highlight
|
|
||||||
BUFFER='sudo -u >/tmp otheruser ls; sudo ls; sudo -i ls'
|
BUFFER='sudo -u >/tmp otheruser ls; sudo ls; sudo -i ls'
|
||||||
|
|
||||||
expected_region_highlight=(
|
expected_region_highlight=(
|
||||||
|
@ -27,7 +27,6 @@
|
|||||||
# vim: ft=zsh sw=2 ts=2 et
|
# vim: ft=zsh sw=2 ts=2 et
|
||||||
# -------------------------------------------------------------------------------------------------
|
# -------------------------------------------------------------------------------------------------
|
||||||
|
|
||||||
ZSH_HIGHLIGHT_STYLES[redirection]=$unused_highlight
|
|
||||||
BUFFER='sudo >/tmp -u otheruser ls'
|
BUFFER='sudo >/tmp -u otheruser ls'
|
||||||
|
|
||||||
expected_region_highlight=(
|
expected_region_highlight=(
|
||||||
|
@ -27,7 +27,6 @@
|
|||||||
# vim: ft=zsh sw=2 ts=2 et
|
# vim: ft=zsh sw=2 ts=2 et
|
||||||
# -------------------------------------------------------------------------------------------------
|
# -------------------------------------------------------------------------------------------------
|
||||||
|
|
||||||
ZSH_HIGHLIGHT_STYLES[redirection]=$unused_highlight
|
|
||||||
BUFFER='sudo 2>./. -u otheruser ls'
|
BUFFER='sudo 2>./. -u otheruser ls'
|
||||||
|
|
||||||
expected_region_highlight=(
|
expected_region_highlight=(
|
||||||
|
@ -27,7 +27,6 @@
|
|||||||
# vim: ft=zsh sw=2 ts=2 et
|
# vim: ft=zsh sw=2 ts=2 et
|
||||||
# -------------------------------------------------------------------------------------------------
|
# -------------------------------------------------------------------------------------------------
|
||||||
|
|
||||||
ZSH_HIGHLIGHT_STYLES[command]=$unused_highlight
|
|
||||||
BUFFER='\sh'
|
BUFFER='\sh'
|
||||||
|
|
||||||
expected_region_highlight=(
|
expected_region_highlight=(
|
||||||
|
@ -63,7 +63,6 @@ ZSH_HIGHLIGHT_HIGHLIGHTERS=($1)
|
|||||||
# $1: data file
|
# $1: data file
|
||||||
run_test_internal() {
|
run_test_internal() {
|
||||||
local -a highlight_zone
|
local -a highlight_zone
|
||||||
local unused_highlight='bg=red,underline' # a style unused by anything else, for tests to use
|
|
||||||
|
|
||||||
local tests_tempdir="$1"; shift
|
local tests_tempdir="$1"; shift
|
||||||
local srcdir="$PWD"
|
local srcdir="$PWD"
|
||||||
|
@ -57,7 +57,6 @@ ZSH_HIGHLIGHT_HIGHLIGHTERS=($1)
|
|||||||
# $1: data file
|
# $1: data file
|
||||||
run_test_internal() {
|
run_test_internal() {
|
||||||
local -a highlight_zone
|
local -a highlight_zone
|
||||||
local unused_highlight='bg=red,underline' # a style unused by anything else, for tests to use
|
|
||||||
|
|
||||||
local tests_tempdir="$1"; shift
|
local tests_tempdir="$1"; shift
|
||||||
local srcdir="$PWD"
|
local srcdir="$PWD"
|
||||||
|
Loading…
Reference in New Issue
Block a user