Skip to content

Commit a9be097

Browse files
committed
tests: Directly diff expected_region_highlight against region_highlight
1 parent 622358f commit a9be097

File tree

78 files changed

+219
-121
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

78 files changed

+219
-121
lines changed

highlighters/brackets/test-data/cursor-matchingbracket-line-finish.zsh

-1
Original file line numberDiff line numberDiff line change
@@ -33,5 +33,4 @@ BUFFER=': $foo[bar]'
3333
CURSOR=6 # cursor is zero-based
3434

3535
expected_region_highlight=(
36-
"11 11 NONE"
3736
)

highlighters/brackets/test-data/cursor-matchingbracket.zsh

+8
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,8 @@
2727
# vim: ft=zsh sw=2 ts=2 et
2828
# -------------------------------------------------------------------------------------------------
2929

30+
unsorted=1
31+
3032
ZSH_HIGHLIGHT_STYLES[bracket-level-1]=
3133
ZSH_HIGHLIGHT_STYLES[bracket-level-2]=
3234
ZSH_HIGHLIGHT_STYLES[bracket-level-3]=
@@ -35,5 +37,11 @@ BUFFER=': ((( )))'
3537
CURSOR=2 # cursor is zero-based
3638

3739
expected_region_highlight=(
40+
"3 3 bracket-level-1"
41+
"4 4 bracket-level-2"
42+
"5 5 bracket-level-3"
43+
"7 7 bracket-level-3"
44+
"8 8 bracket-level-2"
45+
"9 9 bracket-level-1"
3846
"9 9 cursor-matchingbracket"
3947
)

highlighters/brackets/test-data/empty-styles.zsh

-1
Original file line numberDiff line numberDiff line change
@@ -30,5 +30,4 @@
3030
BUFFER=': (x)'
3131

3232
expected_region_highlight=(
33-
"1 5 NONE"
3433
)

highlighters/brackets/test-data/loop-styles.zsh

+2
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,8 @@
2727
# vim: ft=zsh sw=2 ts=2 et
2828
# -------------------------------------------------------------------------------------------------
2929

30+
unsorted=1
31+
3032
ZSH_HIGHLIGHT_STYLES[bracket-level-1]=
3133
ZSH_HIGHLIGHT_STYLES[bracket-level-2]=
3234
ZSH_HIGHLIGHT_STYLES[bracket-level-3]=

highlighters/brackets/test-data/mismatch-patentheses.zsh

+2
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,8 @@
2727
# vim: ft=zsh sw=2 ts=2 et
2828
# -------------------------------------------------------------------------------------------------
2929

30+
unsorted=1
31+
3032
ZSH_HIGHLIGHT_STYLES[bracket-level-1]=
3133
ZSH_HIGHLIGHT_STYLES[bracket-level-2]=
3234

highlighters/brackets/test-data/near-quotes.zsh

+2-3
Original file line numberDiff line numberDiff line change
@@ -27,17 +27,16 @@
2727
# vim: ft=zsh sw=2 ts=2 et
2828
# -------------------------------------------------------------------------------------------------
2929

30+
unsorted=1
31+
3032
ZSH_HIGHLIGHT_STYLES[bracket-level-1]=
3133
ZSH_HIGHLIGHT_STYLES[bracket-level-2]=
3234

3335
BUFFER=': {"{x}"}'
3436

3537
expected_region_highlight=(
3638
"3 3 bracket-level-1"
37-
"4 4 NONE"
3839
"5 5 bracket-level-2"
39-
"6 6 NONE"
4040
"7 7 bracket-level-2"
41-
"8 8 NONE"
4241
"9 9 bracket-level-1"
4342
)

highlighters/brackets/test-data/nested-parentheses.zsh

+2
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,8 @@
2727
# vim: ft=zsh sw=2 ts=2 et
2828
# -------------------------------------------------------------------------------------------------
2929

30+
unsorted=1
31+
3032
ZSH_HIGHLIGHT_STYLES[bracket-level-1]=
3133
ZSH_HIGHLIGHT_STYLES[bracket-level-2]=
3234
ZSH_HIGHLIGHT_STYLES[bracket-level-3]=

highlighters/brackets/test-data/only-error.zsh

-1
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,5 @@
3030
BUFFER=': x)'
3131

3232
expected_region_highlight=(
33-
"1 3 NONE"
3433
"4 4 bracket-error" # )
3534
)

highlighters/brackets/test-data/quoted-patentheses.zsh

-2
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,5 @@
3030
BUFFER='echo "foo ( bar"'
3131

3232
expected_region_highlight=(
33-
"1 10 NONE"
3433
"11 11 bracket-error"
35-
"12 16 NONE"
3634
)

highlighters/brackets/test-data/simple-parentheses.zsh

+2
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,8 @@
2727
# vim: ft=zsh sw=2 ts=2 et
2828
# -------------------------------------------------------------------------------------------------
2929

30+
unsorted=1
31+
3032
ZSH_HIGHLIGHT_STYLES[bracket-level-1]=
3133
ZSH_HIGHLIGHT_STYLES[bracket-level-2]=
3234

highlighters/brackets/test-data/unclosed-patentheses.zsh

+2
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,8 @@
2727
# vim: ft=zsh sw=2 ts=2 et
2828
# -------------------------------------------------------------------------------------------------
2929

30+
unsorted=1
31+
3032
ZSH_HIGHLIGHT_STYLES[bracket-level-1]=
3133
ZSH_HIGHLIGHT_STYLES[bracket-level-2]=
3234

highlighters/brackets/test-data/unclosed-patentheses2.zsh

+2
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,8 @@
2727
# vim: ft=zsh sw=2 ts=2 et
2828
# -------------------------------------------------------------------------------------------------
2929

30+
unsorted=1
31+
3032
ZSH_HIGHLIGHT_STYLES[bracket-level-1]=
3133

3234
BUFFER='echo {x})'

highlighters/main/test-data/alias-assignment1.zsh

+1
Original file line numberDiff line numberDiff line change
@@ -34,4 +34,5 @@ BUFFER='x=y ls'
3434

3535
expected_region_highlight=(
3636
"1 3 unknown-token" # x=y
37+
"5 6 default" # ls
3738
)

highlighters/main/test-data/alias.zsh

+1
Original file line numberDiff line numberDiff line change
@@ -49,5 +49,6 @@ if zmodload -e zsh/parameter || [[ "$(type -w x.alias2)" == *suffix* ]]; then
4949
)
5050
fi
5151
expected_region_highlight+=(
52+
"9 9 commandseparator" # ;
5253
"11 16 alias" # alias1
5354
)

highlighters/main/test-data/anonymous-function.zsh

+3
Original file line numberDiff line numberDiff line change
@@ -37,5 +37,8 @@ expected_region_highlight=(
3737
"16 17 reserved-word" # ()
3838
"19 19 reserved-word" # {
3939
"21 24 builtin" # echo
40+
"26 30 default" # world
41+
"32 32 reserved-word" # }
42+
"34 43 default" # "argument"
4043
"34 43 double-quoted-argument" # "argument"
4144
)

highlighters/main/test-data/assign-append.zsh

+3
Original file line numberDiff line numberDiff line change
@@ -31,4 +31,7 @@ BUFFER='a+=(lorem ipsum)'
3131

3232
expected_region_highlight=(
3333
"1 4 assign" # a+=(
34+
"5 9 default" # lorem
35+
"11 15 default" # ipsum
36+
"16 16 assign" # )
3437
)

highlighters/main/test-data/assign-array.zsh

+2
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,8 @@ BUFFER='(A=(hello world))'
3232
expected_region_highlight=(
3333
"1 1 reserved-word" # (
3434
"2 4 assign" # A=(
35+
"5 9 default" # hello
36+
"11 15 default" # world
3537
"16 16 assign" # )
3638
"17 17 reserved-word" # )
3739
)

highlighters/main/test-data/assign-array2.zsh

+2
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,8 @@ BUFFER='A=(hello world) ls'
3131

3232
expected_region_highlight=(
3333
"1 3 assign" # A=(
34+
"4 8 default" # hello
35+
"10 14 default" # world
3436
"15 15 assign" # )
3537
"17 18 command" # ls
3638
)

highlighters/main/test-data/assign-array3.zsh

+2
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,8 @@ BUFFER='A=(hello world) b=42'
3131

3232
expected_region_highlight=(
3333
"1 3 assign" # A=(
34+
"4 8 default" # hello
35+
"10 14 default" # world
3436
"15 15 assign" # )
3537
"17 20 assign" # b=42
3638
)

highlighters/main/test-data/assign-semicolon.zsh

+3
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,9 @@
3030
BUFFER='A=1; echo hello world'
3131

3232
expected_region_highlight=(
33+
"1 3 assign" # A=1
3334
"4 4 commandseparator" # ;
3435
"6 9 builtin" # echo
36+
"11 15 default" # hello
37+
"17 21 default" # world
3538
)

highlighters/main/test-data/assign.zsh

+1
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@ BUFFER='A=1 b=("foo" bar)'
3232
expected_region_highlight=(
3333
"1 3 assign" # A=1
3434
"5 7 assign" # b=(
35+
"8 12 default" # "foo"
3536
"8 12 double-quoted-argument" # "foo"
3637
"14 16 default" # bar
3738
"17 17 assign" # )

highlighters/main/test-data/back-quoted-argument.zsh

+5-2
Original file line numberDiff line numberDiff line change
@@ -31,9 +31,12 @@
3131
BUFFER='echo `echo \`42\`` "is `echo equal` to" `echo 6 times 9'
3232

3333
expected_region_highlight=(
34+
"1 4 builtin" # echo
35+
"6 18 default" # `echo \`42\``
3436
"6 18 back-quoted-argument" # `echo \`42\``
35-
"20 23 double-quoted-argument" # "is
37+
"20 39 default" # "is `echo equal` to"
38+
"20 39 double-quoted-argument" # "is `echo equal` to"
3639
"24 35 back-quoted-argument" # `echo equal`
37-
"36 39 double-quoted-argument" # to"
40+
"41 55 default" # `echo 6 times 9
3841
"41 55 back-quoted-argument-unclosed" # `echo 6 times 9
3942
)

highlighters/main/test-data/brackets-mismatch7.zsh

+1
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@ expected_region_highlight=(
3434
'1 3 reserved-word' # for
3535
'5 5 default' # n
3636
'7 8 default' # in
37+
'10 10 default' # *
3738
'10 10 globbing' # *
3839
'11 11 commandseparator' # ;
3940
'13 14 reserved-word' # do

highlighters/main/test-data/commandseparator.zsh

+1
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@
3030
BUFFER=':; pwd &! ls'
3131

3232
expected_region_highlight=(
33+
"1 1 builtin" # :
3334
"2 2 commandseparator" # ;
3435
"4 6 builtin" # pwd
3536
"8 9 commandseparator" # &!

highlighters/main/test-data/comment-leading.zsh

+1-2
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,5 @@ setopt interactive_comments
3232
BUFFER='# echo foo'
3333

3434
expected_region_highlight=(
35-
"1 1 comment" # #
36-
"2 10 comment" # " echo foo"
35+
"1 10 comment" # # echo foo
3736
)

highlighters/main/test-data/comments.zsh

+1
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@ BUFFER='echo "foo #bar" #baz # quux'
3333

3434
expected_region_highlight=(
3535
"1 4 builtin" # echo
36+
"6 15 default" # "foo #bar"
3637
"6 15 double-quoted-argument" # "foo #bar"
3738
"17 27 comment" # #baz # quux
3839
)

highlighters/main/test-data/commmand-parameter.zsh

+1
Original file line numberDiff line numberDiff line change
@@ -32,5 +32,6 @@ BUFFER='$x "argument"'
3232

3333
expected_region_highlight=(
3434
"1 2 command" # $x
35+
"4 13 default" # "argument"
3536
"4 13 double-quoted-argument" # "argument"
3637
)

highlighters/main/test-data/control-flow.zsh

+7
Original file line numberDiff line numberDiff line change
@@ -34,17 +34,24 @@ expected_region_highlight+=(
3434
"7 8 reserved-word" # if
3535
"10 13 builtin" # echo
3636
"15 19 default" # Hello
37+
"20 20 commandseparator" # ;
3738
"22 25 reserved-word" # then
3839
"27 28 command" # ls
3940
"30 30 path" # /
4041
"31 31 commandseparator" # ;
4142
"33 36 reserved-word" # else
4243
"38 39 command" # ls
44+
"40 40 commandseparator" # ;
4345
"42 43 reserved-word" # fi
46+
"44 44 commandseparator" # ;
4447
"46 47 reserved-word" # do
4548
"49 52 command" # stat
49+
"54 56 default" # "x"
4650
"54 56 double-quoted-argument" # "x"
51+
"57 57 commandseparator" # ;
4752
"59 62 reserved-word" # done
53+
"63 63 commandseparator" # ;
4854
"65 70 reserved-word" # repeat
55+
"72 73 default" # 10
4956
"75 76 command" # ls
5057
)

highlighters/main/test-data/dollar-dollar.zsh

+2-2
Original file line numberDiff line numberDiff line change
@@ -32,8 +32,8 @@ BUFFER=': "$$ $$foo"'
3232

3333
expected_region_highlight=(
3434
'1 1 builtin' # :
35-
'3 3 double-quoted-argument' # "
35+
'3 12 default' # "$$ $$foo"
36+
'3 12 double-quoted-argument' # "$$ $$foo"
3637
'4 5 dollar-double-quoted-argument' # $$
3738
'7 8 dollar-double-quoted-argument' # $$
38-
'9 12 double-quoted-argument' # foo"
3939
)

highlighters/main/test-data/dollar-noise.zsh

+2-6
Original file line numberDiff line numberDiff line change
@@ -32,15 +32,11 @@ BUFFER=': "$- $# $* $@ $?"'
3232

3333
expected_region_highlight=(
3434
'1 1 builtin' # :
35-
'3 3 double-quoted-argument' # "
35+
'3 18 default' # "$- $# $* $@ $?"
36+
'3 18 double-quoted-argument' # "$- $# $* $@ $?"
3637
'4 5 dollar-double-quoted-argument' # $-
37-
'6 6 double-quoted-argument' # <space>
3838
'7 8 dollar-double-quoted-argument' # $#
39-
'9 9 double-quoted-argument' # <space>
4039
'10 11 dollar-double-quoted-argument' # $*
41-
'12 12 double-quoted-argument' # <space>
4240
'13 14 dollar-double-quoted-argument' # $@
43-
'15 15 double-quoted-argument' # <space>
4441
'16 17 dollar-double-quoted-argument' # $?
45-
'18 18 double-quoted-argument' # "
4642
)

highlighters/main/test-data/dollar-paren.zsh

+2-2
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ BUFFER=': "$(:)"'
3232

3333
expected_region_highlight=(
3434
'1 1 builtin' # :
35-
'3 3 double-quoted-argument' # "
35+
'3 8 default' # "$(:)"
36+
'3 8 double-quoted-argument' # "$(:)"
3637
'4 4 dollar-double-quoted-argument' # $
37-
'5 8 double-quoted-argument' # (:)"
3838
)

highlighters/main/test-data/dollar-quoted.zsh

+3
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,9 @@
3030
BUFFER=": \$'*' 'foo'"
3131

3232
expected_region_highlight=(
33+
"1 1 builtin" # :
34+
"3 6 default" # $'*'
3335
"3 6 dollar-quoted-argument" # $'*' - not a glob
36+
"8 12 default" # 'foo'
3437
"8 12 single-quoted-argument" # 'foo'
3538
)

highlighters/main/test-data/dollar-quoted2.zsh

+3-4
Original file line numberDiff line numberDiff line change
@@ -30,11 +30,10 @@
3030
BUFFER=": \$'foo\xbar\udeadbeef\uzzzz'"
3131

3232
expected_region_highlight=(
33-
"3 7 dollar-quoted-argument" # $'foo
33+
"1 1 builtin" # :
34+
"3 29 default" # $'foo\xbar\udeadbeef\uzzzz'
35+
"3 29 dollar-quoted-argument" # $'foo\xbar\udeadbeef\uzzzz'
3436
"8 11 back-dollar-quoted-argument" # \xba
35-
"12 12 dollar-quoted-argument" # r
3637
"13 18 back-dollar-quoted-argument" # \dead
37-
"19 22 dollar-quoted-argument" # beef
3838
"23 24 unknown-token" # \u
39-
"25 29 dollar-quoted-argument" # zzzz'
4039
)

highlighters/main/test-data/dollar-quoted3.zsh

+3-1
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,8 @@
3232
BUFFER=": \$'\xa1"
3333

3434
expected_region_highlight=(
35-
"3 4 dollar-quoted-argument-unclosed" # $'
35+
"1 1 builtin" # :
36+
"3 8 default" # $'\xa1
37+
"3 8 dollar-quoted-argument-unclosed" # $'\xa1
3638
"5 8 back-dollar-quoted-argument" # \xa1
3739
)

highlighters/main/test-data/double-hyphen-option.zsh

+1
Original file line numberDiff line numberDiff line change
@@ -30,5 +30,6 @@
3030
BUFFER='hello --world'
3131

3232
expected_region_highlight=(
33+
"1 5 unknown-token" # hello
3334
"7 13 double-hyphen-option" # --world
3435
)

highlighters/main/test-data/double-quoted.zsh

+3-6
Original file line numberDiff line numberDiff line change
@@ -31,15 +31,12 @@ BUFFER=': "foo$bar:\`:\":\$:'
3131
BUFFER+=\\\\:\"
3232

3333
expected_region_highlight=(
34-
"3 6 double-quoted-argument" # "foo
34+
"1 1 builtin" # :
35+
"3 24 default" # "foo$bar:\`:\":\$:\\:"
36+
"3 24 double-quoted-argument" # "foo$bar:\`:\":\$:\\:"
3537
"7 10 dollar-double-quoted-argument" # $bar
36-
"11 11 double-quoted-argument" # :
3738
"12 13 back-double-quoted-argument" # \`
38-
"14 14 double-quoted-argument" # :
3939
"15 16 back-double-quoted-argument" # \$
40-
"17 17 double-quoted-argument" # :
4140
"18 19 back-double-quoted-argument" # \"
42-
"20 20 double-quoted-argument" # :
4341
"21 22 back-double-quoted-argument" # \\
44-
"23 24 double-quoted-argument" # :"
4542
)

highlighters/main/test-data/double-quoted2.zsh

+3-1
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,8 @@
3232
BUFFER=': "foo$bar'
3333

3434
expected_region_highlight=(
35-
"3 6 double-quoted-argument-unclosed" # "foo
35+
"1 1 builtin" # :
36+
"3 10 default" # "foo$bar
37+
"3 10 double-quoted-argument-unclosed" # "foo$bar
3638
"7 10 dollar-double-quoted-argument" # $bar
3739
)

0 commit comments

Comments
 (0)