]> git.ipfire.org Git - thirdparty/vim.git/commitdiff
patch 8.2.3839: using \z() with \z1 not tested for syntax highlighting v8.2.3839
authorDominique Pelle <dominique.pelle@gmail.com>
Fri, 17 Dec 2021 17:32:29 +0000 (17:32 +0000)
committerBram Moolenaar <Bram@vim.org>
Fri, 17 Dec 2021 17:32:29 +0000 (17:32 +0000)
Problem:    Using \z() with \z1 not tested for syntax highlighting.
Solution:   Add a test. (Dominique PellĂ©, closes #9365)

src/testdir/test_syntax.vim
src/version.c

index 83a63c4213da61e866c13415fa37c26ee45d564b..14ae4c575ff98e027f04520090cd5beaa73b05f5 100644 (file)
@@ -662,6 +662,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
index eb09d61cd1c0896caf59bab97560bda400b1a096..be0122d77bed31c122ad8eacf4f8d07959bdd030 100644 (file)
@@ -749,6 +749,8 @@ static char *(features[]) =
 
 static int included_patches[] =
 {   /* Add new patch number below this line */
+/**/
+    3839,
 /**/
     3838,
 /**/