]> git.ipfire.org Git - thirdparty/vim.git/commitdiff
patch 9.2.0392: tests: Some tests are flaky v9.2.0392
authorChristian Brabandt <cb@256bit.org>
Sat, 25 Apr 2026 17:50:47 +0000 (17:50 +0000)
committerChristian Brabandt <cb@256bit.org>
Sat, 25 Apr 2026 17:50:47 +0000 (17:50 +0000)
Problem:  tests: Some tests are flaky and cause CI to fail
Solution: Add WaitForAsserts() calls to reduce flakiness

closes: #20050

Signed-off-by: Christian Brabandt <cb@256bit.org>
12 files changed:
src/testdir/test_breakindent.vim
src/testdir/test_digraph.vim
src/testdir/test_display.vim
src/testdir/test_edit.vim
src/testdir/test_highlight.vim
src/testdir/test_plugin_matchparen.vim
src/testdir/test_search.vim
src/testdir/test_search_stat.vim
src/testdir/test_tabpanel.vim
src/testdir/test_vim9_cmd.vim
src/testdir/test_visual.vim
src/version.c

index bb164f70ea8582508d5e76365a2888c6daf4fca3..b309108c941c0404e3230fa736f9ac8a518c078e 100644 (file)
@@ -988,6 +988,7 @@ func Test_visual_starts_before_skipcol()
   let buf = RunVimInTerminal('-S XvisualStartsBeforeSkipcol', #{rows: 6})
 
   call term_sendkeys(buf, "v$")
+  call WaitForAssert({-> assert_match('VISUAL.*\d', term_getline(buf, 6))}, 1000)
   call VerifyScreenDump(buf, 'Test_visual_starts_before_skipcol_1', {})
   call term_sendkeys(buf, "\<Esc>:setlocal showbreak=+++\<CR>gv")
   call VerifyScreenDump(buf, 'Test_visual_starts_before_skipcol_2', {})
index 96b2b63baf50b4c3f3402d556574a22cf7f00f0a..23d8a83aadb79538e84a165bb230f04fb7141d65 100644 (file)
@@ -510,14 +510,11 @@ func Test_entering_digraph()
   CheckRunVimInTerminal
   let buf = RunVimInTerminal('', {'rows': 6})
   call term_sendkeys(buf, "i\<C-K>")
-  call TermWait(buf)
-  call assert_equal('?', term_getline(buf, 1))
+  call WaitForAssert({-> assert_equal('?', term_getline(buf, 1))}, 1000)
   call term_sendkeys(buf, "1")
-  call TermWait(buf)
-  call assert_equal('1', term_getline(buf, 1))
+  call WaitForAssert({-> assert_equal('1', term_getline(buf, 1))}, 1000)
   call term_sendkeys(buf, "2")
-  call TermWait(buf)
-  call assert_equal('½', term_getline(buf, 1))
+  call WaitForAssert({-> assert_equal('½', term_getline(buf, 1))}, 1000)
   call StopVimInTerminal(buf)
 endfunc
 
index cbb4f4fc6d392a3c541ef49abbe46b5eb007aa23..5fee79716294a03930763eeaeb2f7033ecbd48bf 100644 (file)
@@ -260,6 +260,7 @@ func Test_display_scroll_update_visual()
 
   let buf = RunVimInTerminal('-S XupdateVisual.vim', #{rows: 8, cols: 60})
   call term_sendkeys(buf, "VG7kk")
+  call WaitForAssert({-> assert_match('VISUAL.*\d\+\s\+\d', term_getline(buf, 8))}, 1000)
   call VerifyScreenDump(buf, 'Test_display_scroll_update_visual', {})
 
   call StopVimInTerminal(buf)
index 6ac115d77545428d7c82a2e912eee437c76f2d9e..196933f7d93d3a1b87dc718108d47c8862d9b282 100644 (file)
@@ -2070,6 +2070,7 @@ func Test_edit_ctrl_r_failed()
 
   " trying to insert a blob produces an error
   call term_sendkeys(buf, "i\<C-R>=0z\<CR>")
+  call WaitForAssert({-> assert_match('^E976:', term_getline(buf, 5))}, 1000)
 
   " ending Insert mode should put the cursor back on the ':'
   call term_sendkeys(buf, ":\<Esc>")
index ef593b8b358dbbc798fb18f29698608e938507c8..1a017083bf5fe222a3b44420f254ad085e0939ce 100644 (file)
@@ -765,6 +765,7 @@ func Test_visual_sbr()
   let buf = RunVimInTerminal('-S Xtest_visual_sbr', {'rows': 6,'columns': 60})
 
   call term_sendkeys(buf, "v$")
+  call WaitForAssert({-> assert_match('VISUAL.*\d\+\s\+\d', term_getline(buf, 6))}, 1000)
   call VerifyScreenDump(buf, 'Test_visual_sbr_1', {})
 
   " clean up
index a05fc5ddd24d66571729481cfd82f8d522a247d3..cc6513bb6fee57d0c562a1316b8b1a527d49ebde 100644 (file)
@@ -23,6 +23,7 @@ func Test_visual_block_scroll()
   let buf = RunVimInTerminal('-S '.filename, #{rows: 7})
   call term_sendkeys(buf, "V\<C-D>\<C-D>")
 
+  call WaitForAssert({-> assert_match('VISUAL.*\d\+\s\+\d', term_getline(buf, 7))}, 1000)
   call VerifyScreenDump(buf, 'Test_display_visual_block_scroll', {})
 
   call StopVimInTerminal(buf)
index 0a50681751054a0437c740c8ab0afe2166ba3e20..c4178fdece7ed5ef6a279df08131a36dfd555529 100644 (file)
@@ -1053,6 +1053,7 @@ func Test_hlsearch_and_visual()
        \ ], 'Xhlvisual_script', 'D')
   let buf = RunVimInTerminal('-S Xhlvisual_script', {'rows': 6, 'cols': 40})
   call term_sendkeys(buf, "vjj")
+  call WaitForAssert({-> assert_match('VISUAL.*-\d', term_getline(buf, 6))}, 1000)
   call VerifyScreenDump(buf, 'Test_hlsearch_visual_1', {})
   call term_sendkeys(buf, "\<Esc>")
 
@@ -2200,6 +2201,7 @@ func Test_incsearch_highlighting_newline()
   [CODE]
   call writefile(commands, 'Xincsearch_nl', 'D')
   let buf = RunVimInTerminal('-S Xincsearch_nl', {'rows': 5, 'cols': 10})
+  call TermWait(buf, 100)
   call term_sendkeys(buf, '/test')
   call VerifyScreenDump(buf, 'Test_incsearch_newline1', {})
   " Need to send one key at a time to force a redraw
index b2a81070b6f69ca34484a8b0688d6b69c705cda1..59d21c4e7424e46177ebf27d643a8df6d18db311 100644 (file)
@@ -411,16 +411,23 @@ func Test_search_stat_and_incsearch()
   call writefile(lines, 'Xsearchstat_inc', 'D')
 
   let buf = RunVimInTerminal('-S Xsearchstat_inc', #{rows: 10})
+  call TermWait(buf, 100)
   call term_sendkeys(buf, "/abc")
   call TermWait(buf)
+  " The first 3 chars on line 2 should have highlighting, but the following not
+  " So assert the attr value of those 4 chars
+  call WaitForAssert({-> assert_true(
+    \ term_scrape(buf, 2)[0].attr == term_scrape(buf, 2)[1].attr &&
+    \ term_scrape(buf, 2)[1].attr == term_scrape(buf, 2)[2].attr &&
+    \ term_scrape(buf, 2)[2].attr != term_scrape(buf, 2)[3].attr)}, 1000)
   call VerifyScreenDump(buf, 'Test_searchstat_inc_1', {})
 
   call term_sendkeys(buf, "\<c-g>")
-  call TermWait(buf)
+  call WaitForAssert({-> assert_match('^3', term_getline(buf, 1))}, 1000)
   call VerifyScreenDump(buf, 'Test_searchstat_inc_2', {})
 
   call term_sendkeys(buf, "\<c-g>")
-  call TermWait(buf)
+  call WaitForAssert({-> assert_match('^1', term_getline(buf, 1))}, 1000)
   call VerifyScreenDump(buf, 'Test_searchstat_inc_3', {})
 
   call term_sendkeys(buf, "\<esc>:qa\<cr>")
index 427360aeda388ffc3f0e9a4c94aaa552a5a63147..0f6aa0b56891790b4d709a2792080d77138887df 100644 (file)
@@ -551,6 +551,7 @@ function Test_tabpanel_visual()
 
   let buf = RunVimInTerminal('-S XTest_tabpanel_visual', {'rows': 10, 'cols': 45})
   call term_sendkeys(buf, "v2w")
+  call WaitForAssert({-> assert_match('VISUAL.*\d', term_getline(buf, 10))}, 1000)
   call VerifyScreenDump(buf, 'Test_tabpanel_visual_0', {})
   call term_sendkeys(buf, "\<Esc>0jw")
   call term_sendkeys(buf, "v2wge")
index 22f33edf5c18cdbafe427cf7ed889a1fd6258fe9..b54a58b5098abda3f61d6108c744a17dab69a5f6 100644 (file)
@@ -952,7 +952,7 @@ func Test_command_modifier_confirm()
   call term_sendkeys(buf, ":call Getout()\n")
   call WaitForAssert({-> assert_match('(Y)es, \[N\]o: ', term_getline(buf, 8))}, 1000)
   call term_sendkeys(buf, "y")
-  call WaitForAssert({-> assert_match('(Y)es, \[N\]o: ', term_getline(buf, 8))}, 1000)
+  call WaitForAssert({-> assert_match('Press ENTER or type command to continue', term_getline(buf, 8))}, 1000)
   call term_sendkeys(buf, "\<CR>")
   call TermWait(buf)
   call StopVimInTerminal(buf)
index ac27354d489f3a220d891d9721fee910fe2f3b0f..d92f651d9abd7fbec2d888aaae51b82ff0782936 100644 (file)
@@ -1321,6 +1321,7 @@ func Test_visual_block_with_virtualedit()
 
   let buf = RunVimInTerminal('-S XTest_block', {'rows': 8, 'cols': 50})
   call term_sendkeys(buf, "\<C-V>gg$")
+  call WaitForAssert({-> assert_match('VISUAL.*\dx\d', term_getline(buf, 8))}, 1000)
   call VerifyScreenDump(buf, 'Test_visual_block_with_virtualedit', {})
 
   call term_sendkeys(buf, "\<Esc>gg\<C-V>G$")
index 41c1753695641c3db88ab33953ac57e86bb982da..8d6be2e96cce05dc11bf8acfb16a30a44a7785d7 100644 (file)
@@ -729,6 +729,8 @@ static char *(features[]) =
 
 static int included_patches[] =
 {   /* Add new patch number below this line */
+/**/
+    392,
 /**/
     391,
 /**/