patch 9.2.0535: tests: matchit plugin is not tested

Commit: 
https://github.com/vim/vim/commit/3a90b2ba8e63926c4c1c5225eced911c8594dcdf
Author: Andrey Starodubtsev <[email protected]>
Date:   Mon May 25 16:29:23 2026 +0000

    patch 9.2.0535: tests: matchit plugin is not tested
    
    Problem:  tests: matchit plugin is not tested
    Solution: Add test_plugin_matchit, improve b:match_words for the html
              filetype plugin (Andrey Starodubtsev)
    
    `b:match_words` which contains patterns used by `matchit` plugin to find
    tag's counterpath, is fixed so that matching happens using the whole
    tag, not just its first letter.
    
    Also, it allows to find matching tag in case if there are spaces or
    attributes after tag name.
    
    fixes:  chrisbra/matchit#51
    closes: #20313
    
    Signed-off-by: Andrey Starodubtsev <[email protected]>
    Signed-off-by: Christian Brabandt <[email protected]>

diff --git a/runtime/ftplugin/html.vim b/runtime/ftplugin/html.vim
index 26b99d2bc..172292fef 100644
--- a/runtime/ftplugin/html.vim
+++ b/runtime/ftplugin/html.vim
@@ -3,6 +3,7 @@
 " Maintainer:          Doug Kearns <[email protected]>
 " Previous Maintainer: Dan Sharp
 " Last Change:         2025 Sep 12
+" 2026 May 25 by Vim plugin: improve the matchit plugin #20313
 
 if exists("b:did_ftplugin")
   finish
@@ -41,7 +42,7 @@ if exists("loaded_matchit") && !exists("b:match_words")
        \             '<:>,' ..
        \             '<\@<=[ou]l\>[^>]*\%(>\|$\):<\@<=li\>:<\@<=/[ou]l>,' ..
        \             '<\@<=dl\>[^>]*\%(>\|$\):<\@<=d[td]\>:<\@<=/dl>,' ..
-       \             '<\@<=\([^/!][^   >]*\)[^>]*\%(>\|$\):<\@<=/ >'
+       \             '<\@<=\([^/!][^   >]*\)\%([       ]\|>\|$\):<\@<=/ >'
   let b:html_set_match_words = 1
   let b:undo_ftplugin ..= " | unlet! b:match_ignorecase b:match_words 
b:html_set_match_words"
 endif
diff --git a/src/testdir/Make_all.mak b/src/testdir/Make_all.mak
index f8c7f8bb4..537c5250f 100644
--- a/src/testdir/Make_all.mak
+++ b/src/testdir/Make_all.mak
@@ -248,6 +248,7 @@ NEW_TESTS = \
        test_plugin_helpcurwin \
        test_plugin_helptoc \
        test_plugin_man \
+       test_plugin_matchit \
        test_plugin_matchparen \
        test_plugin_netrw \
        test_plugin_osc52 \
@@ -526,6 +527,7 @@ NEW_TESTS_RES = \
        test_plugin_helpcurwin.res \
        test_plugin_helptoc.res \
        test_plugin_man.res \
+       test_plugin_matchit.res \
        test_plugin_matchparen.res \
        test_plugin_netrw.res \
        test_plugin_osc52.res \
diff --git a/src/testdir/test_plugin_matchit.vim 
b/src/testdir/test_plugin_matchit.vim
new file mode 100644
index 000000000..1c8144278
--- /dev/null
+++ b/src/testdir/test_plugin_matchit.vim
@@ -0,0 +1,58 @@
+" Tests for the matchit plugin
+
+func SetUp()
+  filetype plugin on
+  packadd matchit
+  call assert_equal('<Plug>(MatchitNormalForward)', maparg('%', 'n', 0))
+endfunc
+
+func TearDown()
+  filetype plugin off
+endfunc
+
+func s:Setup(lines, ft)
+  new
+  call setline(1, a:lines)
+  exe "setl ft=".. a:ft
+  call assert_true(exists('b:match_words'))
+  call assert_true(!empty(b:match_words))
+endfunc
+
+func s:PercentTo(arg)
+  call call('cursor', a:arg)
+  normal %
+  return line('.')
+endfunc
+
+func Test_html_matchit_simple_tag()
+  call s:Setup(['<b>', '<big>some text</big>', '</b>'], 'html')
+  call assert_equal(3, s:PercentTo([1, 2]))
+  call assert_equal(1, s:PercentTo([3, 3]))
+  call assert_equal(2, s:PercentTo([2, 2]))
+  normal %
+  call assert_equal(2, line('.'))
+  bwipe!
+endfunc
+
+func Test_html_matchit_tag_with_attribute()
+  call s:Setup(['<b id="123">', '<big>some text</big>', '</b>'], 'html')
+  call assert_equal(3, s:PercentTo([1, 2]))
+  call assert_equal(1, s:PercentTo([3, 3]))
+  call assert_equal(2, s:PercentTo([2, 2]))
+  normal %
+  call assert_equal(2, line('.'))
+  bwipe!
+endfunc
+
+func Test_html_matchit_tag_multiline_attributes()
+  call s:Setup(['<b', '  id="123"', '  name="abc"', '>',
+        \ '<big>some text</big>', '</b>'], 'html')
+  call assert_equal(6, s:PercentTo([1, 2]))
+  call assert_equal(1, s:PercentTo([6, 3]))
+  call assert_equal(5, s:PercentTo([5, 2]))
+  normal %
+  call assert_equal(5, line('.'))
+  bwipe!
+endfunc
+
+" vim: shiftwidth=2 sts=2 expandtab
diff --git a/src/version.c b/src/version.c
index 14ae41df7..774aee0e7 100644
--- a/src/version.c
+++ b/src/version.c
@@ -729,6 +729,8 @@ static char *(features[]) =
 
 static int included_patches[] =
 {   /* Add new patch number below this line */
+/**/
+    535,
 /**/
     534,
 /**/

-- 
-- 
You received this message from the "vim_dev" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

--- 
You received this message because you are subscribed to the Google Groups 
"vim_dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion visit 
https://groups.google.com/d/msgid/vim_dev/E1wRYQK-0065AQ-Kz%40256bit.org.

Raspunde prin e-mail lui