aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorzeertzjq <zeertzjq@outlook.com>2022-10-27 07:58:51 +0800
committerzeertzjq <zeertzjq@outlook.com>2022-10-27 08:01:38 +0800
commitc031547c8d39c5fc99c6f1fab31b50ba6fb32cbc (patch)
tree85b80a2480c21f8bdb8f4354750cc7a665e9904a
parent624f6a8ca012dd6d27f1e67ace6ef10d04c5625f (diff)
downloadrneovim-c031547c8d39c5fc99c6f1fab31b50ba6fb32cbc.tar.gz
rneovim-c031547c8d39c5fc99c6f1fab31b50ba6fb32cbc.tar.bz2
rneovim-c031547c8d39c5fc99c6f1fab31b50ba6fb32cbc.zip
vim-patch:8.2.3839: using \z() with \z1 not tested for syntax highlighting
Problem: Using \z() with \z1 not tested for syntax highlighting. Solution: Add a test. (Dominique Pellé, closes vim/vim#9365) https://github.com/vim/vim/commit/354b23a9f87fd8c5aec457d88320a0a5bce4b985 Co-authored-by: Dominique Pelle <dominique.pelle@gmail.com>
-rw-r--r--src/nvim/testdir/test_syntax.vim18
1 files changed, 18 insertions, 0 deletions
diff --git a/src/nvim/testdir/test_syntax.vim b/src/nvim/testdir/test_syntax.vim
index 9d617e145c..d686ad7e96 100644
--- a/src/nvim/testdir/test_syntax.vim
+++ b/src/nvim/testdir/test_syntax.vim
@@ -666,6 +666,24 @@ func Test_syntax_c()
call delete('Xtest.c')
endfun
+" Test \z(...) along with \z1
+func Test_syn_zsub()
+ new
+ syntax on
+ call setline(1, 'xxx start foo xxx not end foo xxx end foo xxx')
+ let l:expected = ' ZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZ '
+
+ for l:re in [0, 1, 2]
+ " Example taken from :help :syn-ext-match
+ syntax region Z start="start \z(\I\i*\)" skip="not end \z1" end="end \z1"
+ eval AssertHighlightGroups(1, 1, l:expected, 1, 'regexp=' .. l:re)
+ syntax clear Z
+ endfor
+
+ set re&
+ bw!
+endfunc
+
" Using \z() in a region with NFA failing should not crash.
func Test_syn_wrong_z_one()
new