0
0
mirror of https://github.com/vim/vim.git synced 2025-10-08 06:04:08 -04:00

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 #9365)
This commit is contained in:
Dominique Pelle
2021-12-17 17:32:29 +00:00
committed by Bram Moolenaar
parent db1a410b61
commit 354b23a9f8
2 changed files with 20 additions and 0 deletions

View File

@@ -662,6 +662,24 @@ func Test_syntax_c()
call delete('Xtest.c') call delete('Xtest.c')
endfun 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. " Using \z() in a region with NFA failing should not crash.
func Test_syn_wrong_z_one() func Test_syn_wrong_z_one()
new new

View File

@@ -749,6 +749,8 @@ static char *(features[]) =
static int included_patches[] = static int included_patches[] =
{ /* Add new patch number below this line */ { /* Add new patch number below this line */
/**/
3839,
/**/ /**/
3838, 3838,
/**/ /**/