tests: Specify the style key instead of the style itself

This commit is contained in:
Matthew Martin 2016-04-24 14:22:24 -05:00
parent c54c076cfa
commit a830613467
70 changed files with 246 additions and 246 deletions

View File

@ -30,8 +30,8 @@
BUFFER='echo ({x}]'
expected_region_highlight=(
"6 6 ${(q-)ZSH_HIGHLIGHT_STYLES[bracket-error]}" # (
"7 7 ${(q-)ZSH_HIGHLIGHT_STYLES[bracket-level-2]}" # {
"9 9 ${(q-)ZSH_HIGHLIGHT_STYLES[bracket-level-2]}" # }
"10 10 ${(q-)ZSH_HIGHLIGHT_STYLES[bracket-error]}" # )
"6 6 bracket-error" # (
"7 7 bracket-level-2" # {
"9 9 bracket-level-2" # }
"10 10 bracket-error" # )
)

View File

@ -30,10 +30,10 @@
BUFFER='echo $(echo ${(z)array})'
expected_region_highlight=(
"7 7 ${(q-)ZSH_HIGHLIGHT_STYLES[bracket-level-1]}" # (
"14 14 ${(q-)ZSH_HIGHLIGHT_STYLES[bracket-level-2]}" # {
"15 15 ${(q-)ZSH_HIGHLIGHT_STYLES[bracket-level-3]}" # (
"17 17 ${(q-)ZSH_HIGHLIGHT_STYLES[bracket-level-3]}" # )
"23 23 ${(q-)ZSH_HIGHLIGHT_STYLES[bracket-level-2]}" # }
"24 24 ${(q-)ZSH_HIGHLIGHT_STYLES[bracket-level-1]}" # )
"7 7 bracket-level-1" # (
"14 14 bracket-level-2" # {
"15 15 bracket-level-3" # (
"17 17 bracket-level-3" # )
"23 23 bracket-level-2" # }
"24 24 bracket-level-1" # )
)

View File

@ -30,5 +30,5 @@
BUFFER='echo "foo ( bar"'
expected_region_highlight=(
"1 16 ${(q-)ZSH_HIGHLIGHT_STYLES[none]}" # We expect the brackets highlighter to do nothing
"1 16 none" # We expect the brackets highlighter to do nothing
)

View File

@ -30,8 +30,8 @@
BUFFER='echo ({x})'
expected_region_highlight=(
"6 6 ${(q-)ZSH_HIGHLIGHT_STYLES[bracket-level-1]}" # (
"7 7 ${(q-)ZSH_HIGHLIGHT_STYLES[bracket-level-2]}" # {
"9 9 ${(q-)ZSH_HIGHLIGHT_STYLES[bracket-level-2]}" # }
"10 10 ${(q-)ZSH_HIGHLIGHT_STYLES[bracket-level-1]}" # )
"6 6 bracket-level-1" # (
"7 7 bracket-level-2" # {
"9 9 bracket-level-2" # }
"10 10 bracket-level-1" # )
)

View File

@ -30,7 +30,7 @@
BUFFER='echo ({x}'
expected_region_highlight=(
"6 6 ${(q-)ZSH_HIGHLIGHT_STYLES[bracket-error]}" # (
"7 7 ${(q-)ZSH_HIGHLIGHT_STYLES[bracket-level-2]}" # {
"9 9 ${(q-)ZSH_HIGHLIGHT_STYLES[bracket-level-2]}" # }
"6 6 bracket-error" # (
"7 7 bracket-level-2" # {
"9 9 bracket-level-2" # }
)

View File

@ -30,7 +30,7 @@
BUFFER='echo {x})'
expected_region_highlight=(
"6 6 ${(q-)ZSH_HIGHLIGHT_STYLES[bracket-level-1]}" # {
"8 8 ${(q-)ZSH_HIGHLIGHT_STYLES[bracket-level-1]}" # }
"9 9 ${(q-)ZSH_HIGHLIGHT_STYLES[bracket-error]}" # )
"6 6 bracket-level-1" # {
"8 8 bracket-level-1" # }
"9 9 bracket-error" # )
)

View File

@ -34,5 +34,5 @@ ZSH_HIGHLIGHT_STYLES[alias]=$unused_highlight
BUFFER='x=y ls'
expected_region_highlight=(
"1 3 ${(q-)ZSH_HIGHLIGHT_STYLES[unknown-token]}" # x=y
"1 3 unknown-token" # x=y
)

View File

@ -43,9 +43,9 @@ BUFFER='x.alias2; alias1'
expected_region_highlight=()
if [[ "$(type -w x.alias2)" == *suffix* ]]; then
expected_region_highlight+=(
"1 8 ${(q-)ZSH_HIGHLIGHT_STYLES[suffix-alias]}" # x.alias2
"1 8 suffix-alias" # x.alias2
)
fi
expected_region_highlight+=(
"11 16 ${(q-)ZSH_HIGHLIGHT_STYLES[alias]}" # alias1
"11 16 alias" # alias1
)

View File

@ -30,11 +30,11 @@
BUFFER='() echo hello; () { echo world }'
expected_region_highlight=(
"1 2 ${(q-)ZSH_HIGHLIGHT_STYLES[reserved-word]}" # ()
"4 7 ${(q-)ZSH_HIGHLIGHT_STYLES[builtin]}" # echo
"9 13 ${(q-)ZSH_HIGHLIGHT_STYLES[default]}" # hello
"14 14 ${(q-)ZSH_HIGHLIGHT_STYLES[commandseparator]}" # ;
"16 17 ${(q-)ZSH_HIGHLIGHT_STYLES[reserved-word]}" # ()
"19 19 ${(q-)ZSH_HIGHLIGHT_STYLES[reserved-word]}" # {
"21 24 ${(q-)ZSH_HIGHLIGHT_STYLES[builtin]}" # echo
"1 2 reserved-word" # ()
"4 7 builtin" # echo
"9 13 default" # hello
"14 14 commandseparator" # ;
"16 17 reserved-word" # ()
"19 19 reserved-word" # {
"21 24 builtin" # echo
)

View File

@ -35,6 +35,6 @@
BUFFER='(( x == 42 ))'
expected_region_highlight=(
"1 2 ${(q-)ZSH_HIGHLIGHT_STYLES[reserved-word]}" # ((
"12 13 ${(q-)ZSH_HIGHLIGHT_STYLES[reserved-word]}" # ))
"1 2 reserved-word" # ((
"12 13 reserved-word" # ))
)

View File

@ -31,5 +31,5 @@ ZSH_HIGHLIGHT_STYLES[assign]=$unused_highlight
BUFFER='a+=(lorem ipsum)'
expected_region_highlight=(
"1 4 ${(q-)ZSH_HIGHLIGHT_STYLES[assign]}" # a+=(
"1 4 assign" # a+=(
)

View File

@ -31,8 +31,8 @@ ZSH_HIGHLIGHT_STYLES[assign]=$unused_highlight
BUFFER='(A=(hello world))'
expected_region_highlight=(
"1 1 ${(q-)ZSH_HIGHLIGHT_STYLES[reserved-word]}" # (
"2 4 ${(q-)ZSH_HIGHLIGHT_STYLES[assign]}" # A=(
"16 16 ${(q-)ZSH_HIGHLIGHT_STYLES[assign]}" # )
"17 17 ${(q-)ZSH_HIGHLIGHT_STYLES[reserved-word]}" # )
"1 1 reserved-word" # (
"2 4 assign" # A=(
"16 16 assign" # )
"17 17 reserved-word" # )
)

View File

@ -31,6 +31,6 @@ ZSH_HIGHLIGHT_STYLES[commandseparator]=$unused_highlight
BUFFER='A=1; echo hello world'
expected_region_highlight=(
"4 4 ${(q-)ZSH_HIGHLIGHT_STYLES[commandseparator]}" # ;
"6 9 ${(q-)ZSH_HIGHLIGHT_STYLES[builtin]}" # echo
"4 4 commandseparator" # ;
"6 9 builtin" # echo
)

View File

@ -31,7 +31,7 @@ ZSH_HIGHLIGHT_STYLES[assign]=$unused_highlight
BUFFER='(A=1)'
expected_region_highlight=(
"1 1 ${(q-)ZSH_HIGHLIGHT_STYLES[reserved-word]}" # (
"2 4 ${(q-)ZSH_HIGHLIGHT_STYLES[assign]}" # A=1
"5 5 ${(q-)ZSH_HIGHLIGHT_STYLES[reserved-word]} 'issue #231'" # )
"1 1 reserved-word" # (
"2 4 assign" # A=1
"5 5 reserved-word 'issue #231'" # )
)

View File

@ -31,8 +31,8 @@ ZSH_HIGHLIGHT_STYLES[assign]=$unused_highlight
BUFFER='A=1 b=("foo" bar)'
expected_region_highlight=(
"1 3 ${(q-)ZSH_HIGHLIGHT_STYLES[assign]}" # A=1
"5 7 ${(q-)ZSH_HIGHLIGHT_STYLES[assign]}" # b=(
"8 12 ${(q-)ZSH_HIGHLIGHT_STYLES[double-quoted-argument]}" # "foo"
"17 17 ${(q-)ZSH_HIGHLIGHT_STYLES[assign]}" # )
"1 3 assign" # A=1
"5 7 assign" # b=(
"8 12 double-quoted-argument" # "foo"
"17 17 assign" # )
)

View File

@ -31,5 +31,5 @@ ZSH_HIGHLIGHT_STYLES[back-quoted-argument]=$unused_highlight
BUFFER='echo `echo 42`'
expected_region_highlight=(
"6 14 ${(q-)ZSH_HIGHLIGHT_STYLES[back-quoted-argument]}"
"6 14 back-quoted-argument"
)

View File

@ -31,5 +31,5 @@ PREBUFFER=$'echo \\\n'
BUFFER='noglob'
expected_region_highlight=(
"1 6 ${(q-)ZSH_HIGHLIGHT_STYLES[default]}" # 'noglob' highlighted as a string, not as a precomand
"1 6 default" # 'noglob' highlighted as a string, not as a precomand
)

View File

@ -32,8 +32,8 @@ ZSH_HIGHLIGHT_STYLES[commandseparator]=$unused_highlight
BUFFER=':; pwd &! ls'
expected_region_highlight=(
"2 2 ${(q-)ZSH_HIGHLIGHT_STYLES[commandseparator]}" # ;
"4 6 ${(q-)ZSH_HIGHLIGHT_STYLES[builtin]}" # pwd
"8 9 ${(q-)ZSH_HIGHLIGHT_STYLES[commandseparator]}" # &!
"11 12 ${(q-)ZSH_HIGHLIGHT_STYLES[command]}" # ls
"2 2 commandseparator" # ;
"4 6 builtin" # pwd
"8 9 commandseparator" # &!
"11 12 command" # ls
)

View File

@ -32,6 +32,6 @@ setopt interactive_comments
BUFFER='# echo foo'
expected_region_highlight=(
"1 1 ${(q-)ZSH_HIGHLIGHT_STYLES[comment]}" # #
"2 10 ${(q-)ZSH_HIGHLIGHT_STYLES[comment]}" # " echo foo"
"1 1 comment" # #
"2 10 comment" # " echo foo"
)

View File

@ -32,7 +32,7 @@ unsetopt interactive_comments
BUFFER='# echo foo'
expected_region_highlight=(
"1 1 ${(q-)ZSH_HIGHLIGHT_STYLES[unknown-token]}" # #
"3 6 ${(q-)ZSH_HIGHLIGHT_STYLES[default]}" # " echo foo"
"8 10 ${(q-)ZSH_HIGHLIGHT_STYLES[default]}" # " echo foo"
"1 1 unknown-token" # #
"3 6 default" # " echo foo"
"8 10 default" # " echo foo"
)

View File

@ -32,7 +32,7 @@ setopt interactive_comments
BUFFER='echo "foo #bar" #baz # quux'
expected_region_highlight=(
"1 4 ${(q-)ZSH_HIGHLIGHT_STYLES[builtin]}" # echo
"6 15 ${(q-)ZSH_HIGHLIGHT_STYLES[double-quoted-argument]}" # "foo #bar"
"17 27 ${(q-)ZSH_HIGHLIGHT_STYLES[comment]}" # #baz # quux
"1 4 builtin" # echo
"6 15 double-quoted-argument" # "foo #bar"
"17 27 comment" # #baz # quux
)

View File

@ -31,6 +31,6 @@ x=/usr/bin/env
BUFFER='$x "argument"'
expected_region_highlight=(
"1 2 ${(q-)ZSH_HIGHLIGHT_STYLES[command]}" # $x
"4 13 ${(q-)ZSH_HIGHLIGHT_STYLES[double-quoted-argument]}" # "argument"
"1 2 command" # $x
"4 13 double-quoted-argument" # "argument"
)

View File

@ -31,21 +31,21 @@ ZSH_HIGHLIGHT_STYLES[alias]=$unused_highlight
BUFFER='while if echo Hello; then ls /; else ls; fi; do stat "x"; done; repeat 10 ls'
expected_region_highlight+=(
"1 5 ${(q-)ZSH_HIGHLIGHT_STYLES[reserved-word]}" # while
"7 8 ${(q-)ZSH_HIGHLIGHT_STYLES[reserved-word]}" # if
"10 13 ${(q-)ZSH_HIGHLIGHT_STYLES[builtin]}" # echo
"15 19 ${(q-)ZSH_HIGHLIGHT_STYLES[default]}" # Hello
"22 25 ${(q-)ZSH_HIGHLIGHT_STYLES[reserved-word]}" # then
"27 28 ${(q-)ZSH_HIGHLIGHT_STYLES[command]}" # ls
"30 30 ${(q-)ZSH_HIGHLIGHT_STYLES[path]}" # /
"31 31 ${(q-)ZSH_HIGHLIGHT_STYLES[commandseparator]}" # ;
"33 36 ${(q-)ZSH_HIGHLIGHT_STYLES[reserved-word]}" # else
"38 39 ${(q-)ZSH_HIGHLIGHT_STYLES[command]}" # ls
"42 43 ${(q-)ZSH_HIGHLIGHT_STYLES[reserved-word]}" # fi
"46 47 ${(q-)ZSH_HIGHLIGHT_STYLES[reserved-word]}" # do
"49 52 ${(q-)ZSH_HIGHLIGHT_STYLES[command]}" # stat
"54 56 ${(q-)ZSH_HIGHLIGHT_STYLES[double-quoted-argument]}" # "x"
"59 62 ${(q-)ZSH_HIGHLIGHT_STYLES[reserved-word]}" # done
"65 70 ${(q-)ZSH_HIGHLIGHT_STYLES[reserved-word]}" # repeat
"75 76 ${(q-)ZSH_HIGHLIGHT_STYLES[command]}" # ls
"1 5 reserved-word" # while
"7 8 reserved-word" # if
"10 13 builtin" # echo
"15 19 default" # Hello
"22 25 reserved-word" # then
"27 28 command" # ls
"30 30 path" # /
"31 31 commandseparator" # ;
"33 36 reserved-word" # else
"38 39 command" # ls
"42 43 reserved-word" # fi
"46 47 reserved-word" # do
"49 52 command" # stat
"54 56 double-quoted-argument" # "x"
"59 62 reserved-word" # done
"65 70 reserved-word" # repeat
"75 76 command" # ls
)

View File

@ -31,6 +31,6 @@ ZSH_HIGHLIGHT_STYLES[dollar-quoted-argument]=$unused_highlight
BUFFER=": \$'*' 'foo'"
expected_region_highlight=(
"3 6 ${(q-)ZSH_HIGHLIGHT_STYLES[dollar-quoted-argument]}" # $'*' - not a glob
"8 12 ${(q-)ZSH_HIGHLIGHT_STYLES[single-quoted-argument]}" # 'foo'
"3 6 dollar-quoted-argument" # $'*' - not a glob
"8 12 single-quoted-argument" # 'foo'
)

View File

@ -31,11 +31,11 @@ ZSH_HIGHLIGHT_STYLES[back-dollar-quoted-argument]=$unused_highlight
BUFFER=": \$'foo\xbar\udeadbeef\uzzzz'"
expected_region_highlight=(
"3 7 ${(q-)ZSH_HIGHLIGHT_STYLES[dollar-quoted-argument]}" # $'foo
"8 11 ${(q-)ZSH_HIGHLIGHT_STYLES[back-dollar-quoted-argument]}" # \xba
"12 12 ${(q-)ZSH_HIGHLIGHT_STYLES[dollar-quoted-argument]}" # r
"13 18 ${(q-)ZSH_HIGHLIGHT_STYLES[back-dollar-quoted-argument]}" # \dead
"19 22 ${(q-)ZSH_HIGHLIGHT_STYLES[dollar-quoted-argument]}" # beef
"23 24 ${(q-)ZSH_HIGHLIGHT_STYLES[unknown-token]}" # \u
"25 29 ${(q-)ZSH_HIGHLIGHT_STYLES[dollar-quoted-argument]}" # zzzz'
"3 7 dollar-quoted-argument" # $'foo
"8 11 back-dollar-quoted-argument" # \xba
"12 12 dollar-quoted-argument" # r
"13 18 back-dollar-quoted-argument" # \dead
"19 22 dollar-quoted-argument" # beef
"23 24 unknown-token" # \u
"25 29 dollar-quoted-argument" # zzzz'
)

View File

@ -33,6 +33,6 @@ ZSH_HIGHLIGHT_STYLES[back-dollar-quoted-argument]=$unused_highlight
BUFFER=": \$'\xa1"
expected_region_highlight=(
"3 4 ${(q-)ZSH_HIGHLIGHT_STYLES[dollar-quoted-argument]}" # $'
"5 8 ${(q-)ZSH_HIGHLIGHT_STYLES[back-dollar-quoted-argument]}" # \xa1
"3 4 dollar-quoted-argument" # $'
"5 8 back-dollar-quoted-argument" # \xa1
)

View File

@ -31,5 +31,5 @@ ZSH_HIGHLIGHT_STYLES[double-hyphen-option]=$unused_highlight
BUFFER='hello --world'
expected_region_highlight=(
"7 13 ${(q-)ZSH_HIGHLIGHT_STYLES[double-hyphen-option]}" # --world
"7 13 double-hyphen-option" # --world
)

View File

@ -31,15 +31,15 @@ BUFFER=': "foo$bar:\`:\":\$:'
BUFFER+=\\\\:\"
expected_region_highlight=(
"3 6 ${(q-)ZSH_HIGHLIGHT_STYLES[double-quoted-argument]}" # "foo
"7 10 ${(q-)ZSH_HIGHLIGHT_STYLES[dollar-double-quoted-argument]}" # $bar
"11 11 ${(q-)ZSH_HIGHLIGHT_STYLES[double-quoted-argument]}" # :
"12 13 ${(q-)ZSH_HIGHLIGHT_STYLES[back-double-quoted-argument]}" # \`
"14 14 ${(q-)ZSH_HIGHLIGHT_STYLES[double-quoted-argument]}" # :
"15 16 ${(q-)ZSH_HIGHLIGHT_STYLES[back-double-quoted-argument]}" # \$
"17 17 ${(q-)ZSH_HIGHLIGHT_STYLES[double-quoted-argument]}" # :
"18 19 ${(q-)ZSH_HIGHLIGHT_STYLES[back-double-quoted-argument]}" # \"
"20 20 ${(q-)ZSH_HIGHLIGHT_STYLES[double-quoted-argument]}" # :
"21 22 ${(q-)ZSH_HIGHLIGHT_STYLES[back-double-quoted-argument]}" # \\
"23 24 ${(q-)ZSH_HIGHLIGHT_STYLES[double-quoted-argument]}" # :"
"3 6 double-quoted-argument" # "foo
"7 10 dollar-double-quoted-argument" # $bar
"11 11 double-quoted-argument" # :
"12 13 back-double-quoted-argument" # \`
"14 14 double-quoted-argument" # :
"15 16 back-double-quoted-argument" # \$
"17 17 double-quoted-argument" # :
"18 19 back-double-quoted-argument" # \"
"20 20 double-quoted-argument" # :
"21 22 back-double-quoted-argument" # \\
"23 24 double-quoted-argument" # :"
)

View File

@ -32,6 +32,6 @@
BUFFER=': "foo$bar'
expected_region_highlight=(
"3 6 ${(q-)ZSH_HIGHLIGHT_STYLES[double-quoted-argument]}" # "foo
"7 10 ${(q-)ZSH_HIGHLIGHT_STYLES[dollar-double-quoted-argument]}" # $bar
"3 6 double-quoted-argument" # "foo
"7 10 dollar-double-quoted-argument" # $bar
)

View File

@ -31,9 +31,9 @@ BUFFER=': "$" "$42foo"'
BUFFER+=\ \"\\\'\\x\"
expected_region_highlight=(
"3 5 ${(q-)ZSH_HIGHLIGHT_STYLES[double-quoted-argument]}" # "$"
"7 7 ${(q-)ZSH_HIGHLIGHT_STYLES[double-quoted-argument]}" # "
"8 10 ${(q-)ZSH_HIGHLIGHT_STYLES[dollar-double-quoted-argument]}" # $42
"11 14 ${(q-)ZSH_HIGHLIGHT_STYLES[double-quoted-argument]}" # foo"
"16 21 ${(q-)ZSH_HIGHLIGHT_STYLES[double-quoted-argument]}" # "\'\x" - \' and \x are not escape sequences
"3 5 double-quoted-argument" # "$"
"7 7 double-quoted-argument" # "
"8 10 dollar-double-quoted-argument" # $42
"11 14 double-quoted-argument" # foo"
"16 21 double-quoted-argument" # "\'\x" - \' and \x are not escape sequences
)

View File

@ -30,7 +30,7 @@
BUFFER=': "${foo}bar"'
expected_region_highlight=(
"3 3 ${(q-)ZSH_HIGHLIGHT_STYLES[double-quoted-argument]}" # "
"4 9 ${(q-)ZSH_HIGHLIGHT_STYLES[dollar-double-quoted-argument]}" # ${foo}
"10 13 ${(q-)ZSH_HIGHLIGHT_STYLES[double-quoted-argument]}" # bar"
"3 3 double-quoted-argument" # "
"4 9 dollar-double-quoted-argument" # ${foo}
"10 13 double-quoted-argument" # bar"
)

View File

@ -30,6 +30,6 @@
BUFFER='echo; ;'
expected_region_highlight=(
"5 5 ${(q-)ZSH_HIGHLIGHT_STYLES[commandseparator]}" # ;
"7 7 ${(q-)ZSH_HIGHLIGHT_STYLES[unknown-token]}" # ;
"5 5 commandseparator" # ;
"7 7 unknown-token" # ;
)

View File

@ -33,6 +33,6 @@ touch ';'
BUFFER='echo; ;'
expected_region_highlight=(
"5 5 ${(q-)ZSH_HIGHLIGHT_STYLES[commandseparator]}" # ;
"7 7 ${(q-)ZSH_HIGHLIGHT_STYLES[unknown-token]}" # ;
"5 5 commandseparator" # ;
"7 7 unknown-token" # ;
)

View File

@ -31,9 +31,9 @@ ZSH_HIGHLIGHT_STYLES[redirection]=$unused_highlight
BUFFER='exec {foo}>&/tmp ls'
expected_region_highlight=(
"1 4 ${(q-)ZSH_HIGHLIGHT_STYLES[precommand]}" # exec
# TODO: "6 10 ${(q-)ZSH_HIGHLIGHT_STYLES[redirection]} 'issue #238'" # {foo}
"11 12 ${(q-)ZSH_HIGHLIGHT_STYLES[redirection]}" # >&
"13 16 ${(q-)ZSH_HIGHLIGHT_STYLES[path]}" # /tmp
"18 19 ${(q-)ZSH_HIGHLIGHT_STYLES[command]} 'issue #238'" # ls
"1 4 precommand" # exec
# TODO: "6 10 redirection 'issue #238'" # {foo}
"11 12 redirection" # >&
"13 16 path" # /tmp
"18 19 command 'issue #238'" # ls
)

View File

@ -39,8 +39,8 @@ BUFFER='cd;ls'
# Use $unused_highlight to see that function highlighting has precedence over command and builtin
expected_region_highlight=(
"1 2 ${(q-)ZSH_HIGHLIGHT_STYLES[function]}" # cd
"4 5 ${(q-)ZSH_HIGHLIGHT_STYLES[function]}" # ls
"1 2 function" # cd
"4 5 function" # ls
)
# don't 'unfunction cd ls', since cd() and ls() should still be a functions

View File

@ -30,9 +30,9 @@
BUFFER=': foo* bar? *baz qux\?'
expected_region_highlight=(
"1 1 ${(q-)ZSH_HIGHLIGHT_STYLES[builtin]}" # :
"3 6 ${(q-)ZSH_HIGHLIGHT_STYLES[globbing]}" # foo*
"8 11 ${(q-)ZSH_HIGHLIGHT_STYLES[globbing]}" # bar?
"13 16 ${(q-)ZSH_HIGHLIGHT_STYLES[globbing]}" # *baz
"18 22 ${(q-)ZSH_HIGHLIGHT_STYLES[default]}" # qux\?
"1 1 builtin" # :
"3 6 globbing" # foo*
"8 11 globbing" # bar?
"13 16 globbing" # *baz
"18 22 default" # qux\?
)

View File

@ -32,5 +32,5 @@ ZSH_HIGHLIGHT_STYLES[hashed-command]=$unused_highlight
BUFFER='zsh_syntax_highlighting_hash'
expected_region_highlight=(
"1 28 ${(q-)ZSH_HIGHLIGHT_STYLES[hashed-command]}"
"1 28 hashed-command"
)

View File

@ -31,9 +31,9 @@ ZSH_HIGHLIGHT_STYLES[default]=$unused_highlight
BUFFER='!foo bar !baz ! ; !'
expected_region_highlight=(
"1 4 ${(q-)ZSH_HIGHLIGHT_STYLES[history-expansion]}" # !foo
"6 8 ${(q-)ZSH_HIGHLIGHT_STYLES[default]}" # bar
"10 13 ${(q-)ZSH_HIGHLIGHT_STYLES[history-expansion]}" # !baz
"15 15 ${(q-)ZSH_HIGHLIGHT_STYLES[default]}" # ! (before the semicolon)
"19 19 ${(q-)ZSH_HIGHLIGHT_STYLES[reserved-word]}" # ! (after the semicolon)
"1 4 history-expansion" # !foo
"6 8 default" # bar
"10 13 history-expansion" # !baz
"15 15 default" # ! (before the semicolon)
"19 19 reserved-word" # ! (after the semicolon)
)

View File

@ -30,5 +30,5 @@
BUFFER='^foo^bar'
expected_region_highlight=(
"1 8 ${(q-)ZSH_HIGHLIGHT_STYLES[history-expansion]}" # ^foo^bar
"1 8 history-expansion" # ^foo^bar
)

View File

@ -31,6 +31,6 @@ PREBUFFER=$'echo "foo1\n'
BUFFER='foo2" ./'
expected_region_highlight=(
"1 5 ${(q-)ZSH_HIGHLIGHT_STYLES[double-quoted-argument]}" # 'foo2"'
"7 8 ${(q-)ZSH_HIGHLIGHT_STYLES[path]}" # './'
"1 5 double-quoted-argument" # 'foo2"'
"7 8 path" # './'
)

View File

@ -31,5 +31,5 @@ ZSH_HIGHLIGHT_STYLES[double-quoted-argument]=$unused_highlight
BUFFER=$'echo "foo1\n'
expected_region_highlight=(
"6 10 ${(q-)ZSH_HIGHLIGHT_STYLES[double-quoted-argument]}" # 'foo2"'
"6 10 double-quoted-argument" # 'foo2"'
)

View File

@ -30,17 +30,17 @@
BUFFER='ps aux | grep java | sort | uniq | tail | head'
expected_region_highlight=(
"1 2 ${(q-)ZSH_HIGHLIGHT_STYLES[command]}" # ps
"4 6 ${(q-)ZSH_HIGHLIGHT_STYLES[default]}" # aux
"8 8 ${(q-)ZSH_HIGHLIGHT_STYLES[commandseparator]}" # |
"10 13 ${(q-)ZSH_HIGHLIGHT_STYLES[command]}" # grep
"15 18 ${(q-)ZSH_HIGHLIGHT_STYLES[default]}" # java
"20 20 ${(q-)ZSH_HIGHLIGHT_STYLES[commandseparator]}" # |
"22 25 ${(q-)ZSH_HIGHLIGHT_STYLES[command]}" # sort
"27 27 ${(q-)ZSH_HIGHLIGHT_STYLES[commandseparator]}" # |
"29 32 ${(q-)ZSH_HIGHLIGHT_STYLES[command]}" # uniq
"34 34 ${(q-)ZSH_HIGHLIGHT_STYLES[commandseparator]}" # |
"36 39 ${(q-)ZSH_HIGHLIGHT_STYLES[command]}" # tail
"41 41 ${(q-)ZSH_HIGHLIGHT_STYLES[commandseparator]}" # |
"43 46 ${(q-)ZSH_HIGHLIGHT_STYLES[command]}" # head
"1 2 command" # ps
"4 6 default" # aux
"8 8 commandseparator" # |
"10 13 command" # grep
"15 18 default" # java
"20 20 commandseparator" # |
"22 25 command" # sort
"27 27 commandseparator" # |
"29 32 command" # uniq
"34 34 commandseparator" # |
"36 39 command" # tail
"41 41 commandseparator" # |
"43 46 command" # head
)

View File

@ -31,5 +31,5 @@ alias x=command
BUFFER='x ls'
expected_region_highlight=(
"3 4 ${(q-)ZSH_HIGHLIGHT_STYLES[command]}" # ls
"3 4 command" # ls
)

View File

@ -30,5 +30,5 @@
BUFFER=':; noglob echo *'
expected_region_highlight=(
"16 16 ${(q-)ZSH_HIGHLIGHT_STYLES[default]}" # *
"16 16 default" # *
)

View File

@ -30,6 +30,6 @@
BUFFER='noglob echo *; echo *'
expected_region_highlight=(
"13 13 ${(q-)ZSH_HIGHLIGHT_STYLES[default]}" # *
"21 21 ${(q-)ZSH_HIGHLIGHT_STYLES[globbing]}" # *
"13 13 default" # *
"21 21 globbing" # *
)

View File

@ -37,5 +37,5 @@ path+=( "$PWD"/foo )
BUFFER='bar/testing-issue-228'
expected_region_highlight=(
"1 21 ${(q-)ZSH_HIGHLIGHT_STYLES[command]}" # bar/testing-issue-228
"1 21 command" # bar/testing-issue-228
)

View File

@ -32,6 +32,6 @@ touch "A/mu with spaces"
BUFFER='ls A/mu\ with\ spaces'
expected_region_highlight=(
"1 2 ${(q-)ZSH_HIGHLIGHT_STYLES[command]}" # ls
"4 19 ${(q-)ZSH_HIGHLIGHT_STYLES[path]}" # A/mu\ with\ spaces
"1 2 command" # ls
"4 19 path" # A/mu\ with\ spaces
)

View File

@ -31,6 +31,6 @@ HOME="."
BUFFER='ls ~'
expected_region_highlight=(
"1 2 ${(q-)ZSH_HIGHLIGHT_STYLES[command]}" # ls
"4 4 ${(q-)ZSH_HIGHLIGHT_STYLES[path]}" # ~
"1 2 command" # ls
"4 4 path" # ~
)

View File

@ -31,7 +31,7 @@ HOME="/nonexistent"
BUFFER='ls ~'
expected_region_highlight=(
"1 2 ${(q-)ZSH_HIGHLIGHT_STYLES[command]}" # ls
"4 4 ${(q-)ZSH_HIGHLIGHT_STYLES[default]}" # ~
"1 2 command" # ls
"4 4 default" # ~
)

View File

@ -34,6 +34,6 @@ hash -d D=mydir
BUFFER='ls ~D/path-tilde-named.test'
expected_region_highlight=(
"1 2 ${(q-)ZSH_HIGHLIGHT_STYLES[command]}" # ls
"4 27 ${(q-)ZSH_HIGHLIGHT_STYLES[path]}" # ~D/path-tilde-named.test
"1 2 command" # ls
"4 27 path" # ~D/path-tilde-named.test
)

View File

@ -32,6 +32,6 @@ touch A/mu
BUFFER='ls A/mu'
expected_region_highlight=(
"1 2 ${(q-)ZSH_HIGHLIGHT_STYLES[command]}" # ls
"4 7 ${(q-)ZSH_HIGHLIGHT_STYLES[path]}" # A/mu
"1 2 command" # ls
"4 7 path" # A/mu
)

View File

@ -34,5 +34,5 @@ ZSH_HIGHLIGHT_STYLES[path_prefix]=$unused_highlight
BUFFER='ls /bin/s'
expected_region_highlight=(
"4 9 ${(q-)ZSH_HIGHLIGHT_STYLES[path_prefix]}" # /bin/s
"4 9 path_prefix" # /bin/s
)

View File

@ -35,5 +35,5 @@ BUFFER='ls /bin/s'
WIDGET=accept-line
expected_region_highlight=(
"4 9 ${(q-)ZSH_HIGHLIGHT_STYLES[default]}" # /bin/s
"4 9 default" # /bin/s
)

View File

@ -31,7 +31,7 @@ ZSH_HIGHLIGHT_STYLES[assign]=$unused_highlight
BUFFER=': command zzzzzz'
expected_region_highlight=(
"1 1 ${(q-)ZSH_HIGHLIGHT_STYLES[builtin]}" # :
"3 9 ${(q-)ZSH_HIGHLIGHT_STYLES[default]}" # not precommand
"11 16 ${(q-)ZSH_HIGHLIGHT_STYLES[default]}" # not unknown-token (since 'zzzzzz' is not a command)
"1 1 builtin" # :
"3 9 default" # not precommand
"11 16 default" # not unknown-token (since 'zzzzzz' is not a command)
)

View File

@ -30,10 +30,10 @@
BUFFER='>/tmp >/tmp sudo echo >/tmp foo'
expected_region_highlight=(
"2 5 ${(q-)ZSH_HIGHLIGHT_STYLES[path]}" # /tmp
"8 11 ${(q-)ZSH_HIGHLIGHT_STYLES[path]}" # /tmp
"13 16 ${(q-)ZSH_HIGHLIGHT_STYLES[precommand]}" # sudo
"18 21 ${(q-)ZSH_HIGHLIGHT_STYLES[builtin]}" # echo
"24 27 ${(q-)ZSH_HIGHLIGHT_STYLES[path]}" # /tmp
"29 31 ${(q-)ZSH_HIGHLIGHT_STYLES[default]}" # foo
"2 5 path" # /tmp
"8 11 path" # /tmp
"13 16 precommand" # sudo
"18 21 builtin" # echo
"24 27 path" # /tmp
"29 31 default" # foo
)

View File

@ -32,6 +32,6 @@ ZSH_HIGHLIGHT_STYLES[redirection]=$unused_highlight
BUFFER='<<<foo echo >>&!bar'
expected_region_highlight=(
"1 3 ${(q-)ZSH_HIGHLIGHT_STYLES[redirection]}" # <<<
"13 16 ${(q-)ZSH_HIGHLIGHT_STYLES[redirection]}" # >>&!
"1 3 redirection" # <<<
"13 16 redirection" # >>&!
)

View File

@ -31,8 +31,8 @@ ZSH_HIGHLIGHT_STYLES[reserved-word]=$unused_highlight
BUFFER='repeat "1" do done'
expected_region_highlight=(
"1 6 ${(q-)ZSH_HIGHLIGHT_STYLES[reserved-word]}" # repeat
"8 10 ${(q-)ZSH_HIGHLIGHT_STYLES[double-quoted-argument]}" # "1"
"12 13 ${(q-)ZSH_HIGHLIGHT_STYLES[reserved-word]}" # do
"15 18 ${(q-)ZSH_HIGHLIGHT_STYLES[reserved-word]}" # done
"1 6 reserved-word" # repeat
"8 10 double-quoted-argument" # "1"
"12 13 reserved-word" # do
"15 18 reserved-word" # done
)

View File

@ -30,5 +30,5 @@
BUFFER='ls'
expected_region_highlight=(
"1 2 ${(q-)ZSH_HIGHLIGHT_STYLES[command]}" # ls
"1 2 command" # ls
)

View File

@ -30,9 +30,9 @@
BUFFER='ps aux | grep java'
expected_region_highlight=(
"1 2 ${(q-)ZSH_HIGHLIGHT_STYLES[command]}" # ps
"4 6 ${(q-)ZSH_HIGHLIGHT_STYLES[default]}" # aux
"8 8 ${(q-)ZSH_HIGHLIGHT_STYLES[commandseparator]}" # |
"10 13 ${(q-)ZSH_HIGHLIGHT_STYLES[command]}" # grep
"15 18 ${(q-)ZSH_HIGHLIGHT_STYLES[default]}" # java
"1 2 command" # ps
"4 6 default" # aux
"8 8 commandseparator" # |
"10 13 command" # grep
"15 18 default" # java
)

View File

@ -30,12 +30,12 @@
BUFFER='tar cf - * | (cd /target; tar xfp -) | { cat }'
expected_region_highlight=(
"1 3 ${(q-)ZSH_HIGHLIGHT_STYLES[command]}" # tar
"14 14 ${(q-)ZSH_HIGHLIGHT_STYLES[reserved-word]}" # (
"15 16 ${(q-)ZSH_HIGHLIGHT_STYLES[builtin]}" # cd
"27 29 ${(q-)ZSH_HIGHLIGHT_STYLES[command]}" # tar
"36 36 ${(q-)ZSH_HIGHLIGHT_STYLES[reserved-word]}" # )
"40 40 ${(q-)ZSH_HIGHLIGHT_STYLES[reserved-word]}" # {
"42 44 ${(q-)ZSH_HIGHLIGHT_STYLES[command]}" # cat
"46 46 ${(q-)ZSH_HIGHLIGHT_STYLES[reserved-word]}" # }
"1 3 command" # tar
"14 14 reserved-word" # (
"15 16 builtin" # cd
"27 29 command" # tar
"36 36 reserved-word" # )
"40 40 reserved-word" # {
"42 44 command" # cat
"46 46 reserved-word" # }
)

View File

@ -35,13 +35,13 @@ ZSH_HIGHLIGHT_STYLES[single-hyphen-option]=$unused_highlight
BUFFER='sudo -C3 -u otheruser -i ls /; sudo ; sudo -u ;'
expected_region_highlight=(
"1 4 ${(q-)ZSH_HIGHLIGHT_STYLES[precommand]}" # sudo
"6 8 ${(q-)ZSH_HIGHLIGHT_STYLES[single-hyphen-option]}" # -C3
"10 11 ${(q-)ZSH_HIGHLIGHT_STYLES[single-hyphen-option]}" # -u
"13 21 ${(q-)ZSH_HIGHLIGHT_STYLES[default]}" # otheruser
"23 24 ${(q-)ZSH_HIGHLIGHT_STYLES[single-hyphen-option]}" # -i
"26 27 ${(q-)ZSH_HIGHLIGHT_STYLES[command]}" # ls
"29 29 ${(q-)ZSH_HIGHLIGHT_STYLES[path]}" # /
"37 37 ${(q-)ZSH_HIGHLIGHT_STYLES[unknown-token]}" # ;, error because empty command
"47 47 ${(q-)ZSH_HIGHLIGHT_STYLES[unknown-token]}" # ;, error because incomplete command
"1 4 precommand" # sudo
"6 8 single-hyphen-option" # -C3
"10 11 single-hyphen-option" # -u
"13 21 default" # otheruser
"23 24 single-hyphen-option" # -i
"26 27 command" # ls
"29 29 path" # /
"37 37 unknown-token" # ;, error because empty command
"47 47 unknown-token" # ;, error because incomplete command
)

View File

@ -32,7 +32,7 @@ setopt interactive_comments
BUFFER='sudo -u # comment'
expected_region_highlight=(
"1 4 ${(q-)ZSH_HIGHLIGHT_STYLES[precommand]}" # sudo
"6 7 ${(q-)ZSH_HIGHLIGHT_STYLES[single-hyphen-option]}" # -u
"9 17 ${(q-)ZSH_HIGHLIGHT_STYLES[unknown-token]}" # "# comment" - error because argument missed
"1 4 precommand" # sudo
"6 7 single-hyphen-option" # -u
"9 17 unknown-token" # "# comment" - error because argument missed
)

View File

@ -31,17 +31,17 @@ ZSH_HIGHLIGHT_STYLES[redirection]=$unused_highlight
BUFFER='sudo -u >/tmp otheruser ls; sudo ls; sudo -i ls'
expected_region_highlight=(
"1 4 ${(q-)ZSH_HIGHLIGHT_STYLES[precommand]}" # sudo
"6 7 ${(q-)ZSH_HIGHLIGHT_STYLES[single-hyphen-option]}" # -u
"9 9 ${(q-)ZSH_HIGHLIGHT_STYLES[redirection]}" # >
"10 13 ${(q-)ZSH_HIGHLIGHT_STYLES[path]}" # /tmp
"15 23 ${(q-)ZSH_HIGHLIGHT_STYLES[default]}" # otheruser
"25 26 ${(q-)ZSH_HIGHLIGHT_STYLES[command]}" # ls
"27 27 ${(q-)ZSH_HIGHLIGHT_STYLES[commandseparator]}" # ;
"29 32 ${(q-)ZSH_HIGHLIGHT_STYLES[precommand]}" # sudo
"34 35 ${(q-)ZSH_HIGHLIGHT_STYLES[command]}" # ls
"36 36 ${(q-)ZSH_HIGHLIGHT_STYLES[commandseparator]}" # ;
"38 41 ${(q-)ZSH_HIGHLIGHT_STYLES[precommand]}" # sudo
"43 44 ${(q-)ZSH_HIGHLIGHT_STYLES[single-hyphen-option]}" # -i
"46 47 ${(q-)ZSH_HIGHLIGHT_STYLES[command]}" # ls
"1 4 precommand" # sudo
"6 7 single-hyphen-option" # -u
"9 9 redirection" # >
"10 13 path" # /tmp
"15 23 default" # otheruser
"25 26 command" # ls
"27 27 commandseparator" # ;
"29 32 precommand" # sudo
"34 35 command" # ls
"36 36 commandseparator" # ;
"38 41 precommand" # sudo
"43 44 single-hyphen-option" # -i
"46 47 command" # ls
)

View File

@ -31,10 +31,10 @@ ZSH_HIGHLIGHT_STYLES[redirection]=$unused_highlight
BUFFER='sudo >/tmp -u otheruser ls'
expected_region_highlight=(
"1 4 ${(q-)ZSH_HIGHLIGHT_STYLES[precommand]}" # sudo
"6 6 ${(q-)ZSH_HIGHLIGHT_STYLES[redirection]}" # >
"7 10 ${(q-)ZSH_HIGHLIGHT_STYLES[path]}" # /tmp
"12 13 ${(q-)ZSH_HIGHLIGHT_STYLES[single-hyphen-option]}" # -u
"15 23 ${(q-)ZSH_HIGHLIGHT_STYLES[default]}" # otheruser
"25 26 ${(q-)ZSH_HIGHLIGHT_STYLES[command]}" # ls
"1 4 precommand" # sudo
"6 6 redirection" # >
"7 10 path" # /tmp
"12 13 single-hyphen-option" # -u
"15 23 default" # otheruser
"25 26 command" # ls
)

View File

@ -31,10 +31,10 @@ ZSH_HIGHLIGHT_STYLES[redirection]=$unused_highlight
BUFFER='sudo 2>./. -u otheruser ls'
expected_region_highlight=(
"1 4 ${(q-)ZSH_HIGHLIGHT_STYLES[precommand]}" # sudo
"6 7 ${(q-)ZSH_HIGHLIGHT_STYLES[redirection]}" # 2>
"8 10 ${(q-)ZSH_HIGHLIGHT_STYLES[path]}" # ./. # a 3-character path, for alignment with sudo-redirection2.zsh
"12 13 ${(q-)ZSH_HIGHLIGHT_STYLES[single-hyphen-option]}" # -u
"15 23 ${(q-)ZSH_HIGHLIGHT_STYLES[default]}" # otheruser
"25 26 ${(q-)ZSH_HIGHLIGHT_STYLES[command]}" # ls
"1 4 precommand" # sudo
"6 7 redirection" # 2>
"8 10 path" # ./. # a 3-character path, for alignment with sudo-redirection2.zsh
"12 13 single-hyphen-option" # -u
"15 23 default" # otheruser
"25 26 command" # ls
)

View File

@ -32,6 +32,6 @@ hash -d D=/usr/bin
BUFFER='~D/env foo'
expected_region_highlight=(
"1 6 ${(q-)ZSH_HIGHLIGHT_STYLES[command]}" # ~D/env [= /usr/bin/env]}
"8 10 ${(q-)ZSH_HIGHLIGHT_STYLES[default]}" # foo
"1 6 command" # ~D/env [= /usr/bin/env
"8 10 default" # foo
)

View File

@ -31,5 +31,5 @@ ZSH_HIGHLIGHT_STYLES[command]=$unused_highlight
BUFFER='\sh'
expected_region_highlight=(
"1 3 ${(q-)ZSH_HIGHLIGHT_STYLES[command]}" # \sh (runs 'sh', bypassing aliases)
"1 3 command" # \sh (runs 'sh', bypassing aliases)
)

View File

@ -30,5 +30,5 @@
BUFFER='azertyuiop'
expected_region_highlight=(
"1 10 ${(q-)ZSH_HIGHLIGHT_STYLES[unknown-token]}" # azertyuiop
"1 10 unknown-token" # azertyuiop
)

View File

@ -31,9 +31,9 @@ PREBUFFER=$'echo foo; echo bar\n\n\n'
BUFFER=' echo baz; echo qux'
expected_region_highlight=(
"2 5 ${(q-)ZSH_HIGHLIGHT_STYLES[builtin]}" # echo
"7 9 ${(q-)ZSH_HIGHLIGHT_STYLES[default]}" # baz
"10 10 ${(q-)ZSH_HIGHLIGHT_STYLES[commandseparator]}" # semicolon
"12 15 ${(q-)ZSH_HIGHLIGHT_STYLES[builtin]}" # echo
"17 19 ${(q-)ZSH_HIGHLIGHT_STYLES[default]}" # qux
"2 5 builtin" # echo
"7 9 default" # baz
"10 10 commandseparator" # semicolon
"12 15 builtin" # echo
"17 19 default" # qux
)

View File

@ -103,8 +103,8 @@ run_test_internal() {
highlight_zone=${(z)expected_region_highlight[$i]}
[[ -n "$highlight_zone[4]" ]] && todo=" # TODO $highlight_zone[4]"
for j in {$highlight_zone[1]..$highlight_zone[2]}; do
if [[ "$observed_result[$j]" != "${(Q)highlight_zone[3]}" ]]; then
echo "not ok $i ${(qqq)BUFFER[$highlight_zone[1],$highlight_zone[2]]} [$highlight_zone[1],$highlight_zone[2]]: expected ${(Q)highlight_zone[3]}, observed ${(qqq)observed_result[$j]}.$todo"
if [[ "$observed_result[$j]" != "$ZSH_HIGHLIGHT_STYLES[$highlight_zone[3]]" ]]; then
echo "not ok $i ${(qqq)BUFFER[$highlight_zone[1],$highlight_zone[2]]} [$highlight_zone[1],$highlight_zone[2]]: expected ${(qqq)ZSH_HIGHLIGHT_STYLES[$highlight_zone[3]]}, observed ${(qqq)observed_result[$j]}.$todo"
continue 2
fi
done