comparison src/testdir/test_syntax.vim @ 26620:c4055c13fbe9 v8.2.3839

patch 8.2.3839: using z() with z1 not tested for syntax highlighting Commit: https://github.com/vim/vim/commit/354b23a9f87fd8c5aec457d88320a0a5bce4b985 Author: Dominique Pelle <dominique.pelle@gmail.com> Date: Fri Dec 17 17:32:29 2021 +0000 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 https://github.com/vim/vim/issues/9365)
author Bram Moolenaar <Bram@vim.org>
date Fri, 17 Dec 2021 18:45:04 +0100
parents 485c7c4afeb7
children a7556b47ff09
comparison
equal deleted inserted replaced
26619:ff9d60f09d34 26620:c4055c13fbe9
659 call StopVimInTerminal(buf) 659 call StopVimInTerminal(buf)
660 660
661 let $COLORFGBG = '' 661 let $COLORFGBG = ''
662 call delete('Xtest.c') 662 call delete('Xtest.c')
663 endfun 663 endfun
664
665 " Test \z(...) along with \z1
666 func Test_syn_zsub()
667 new
668 syntax on
669 call setline(1, 'xxx start foo xxx not end foo xxx end foo xxx')
670 let l:expected = ' ZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZ '
671
672 for l:re in [0, 1, 2]
673 " Example taken from :help :syn-ext-match
674 syntax region Z start="start \z(\I\i*\)" skip="not end \z1" end="end \z1"
675 eval AssertHighlightGroups(1, 1, l:expected, 1, 'regexp=' .. l:re)
676 syntax clear Z
677 endfor
678
679 set re&
680 bw!
681 endfunc
664 682
665 " Using \z() in a region with NFA failing should not crash. 683 " Using \z() in a region with NFA failing should not crash.
666 func Test_syn_wrong_z_one() 684 func Test_syn_wrong_z_one()
667 new 685 new
668 call setline(1, ['just some text', 'with foo and bar to match with']) 686 call setline(1, ['just some text', 'with foo and bar to match with'])