patch 9.2.0392: tests: Some tests are flaky
Commit:
https://github.com/vim/vim/commit/1940bcb243984a2586a4b0b8efb3a8728f6a5b54
Author: Christian Brabandt <
c...@256bit.org>
Date: Sat Apr 25 17:50:47 2026 +0000
patch 9.2.0392: tests: Some tests are flaky
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 <
c...@256bit.org>
diff --git a/src/testdir/test_breakindent.vim b/src/testdir/test_breakindent.vim
index bb164f70e..b309108c9 100644
--- a/src/testdir/test_breakindent.vim
+++ b/src/testdir/test_breakindent.vim
@@ -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', {})
diff --git a/src/testdir/test_digraph.vim b/src/testdir/test_digraph.vim
index 96b2b63ba..23d8a83aa 100644
--- a/src/testdir/test_digraph.vim
+++ b/src/testdir/test_digraph.vim
@@ -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
diff --git a/src/testdir/test_display.vim b/src/testdir/test_display.vim
index cbb4f4fc6..5fee79716 100644
--- a/src/testdir/test_display.vim
+++ b/src/testdir/test_display.vim
@@ -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)
diff --git a/src/testdir/test_edit.vim b/src/testdir/test_edit.vim
index 6ac115d77..196933f7d 100644
--- a/src/testdir/test_edit.vim
+++ b/src/testdir/test_edit.vim
@@ -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>")
diff --git a/src/testdir/test_highlight.vim b/src/testdir/test_highlight.vim
index ef593b8b3..1a017083b 100644
--- a/src/testdir/test_highlight.vim
+++ b/src/testdir/test_highlight.vim
@@ -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
diff --git a/src/testdir/test_plugin_matchparen.vim b/src/testdir/test_plugin_matchparen.vim
index a05fc5ddd..cc6513bb6 100644
--- a/src/testdir/test_plugin_matchparen.vim
+++ b/src/testdir/test_plugin_matchparen.vim
@@ -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)
diff --git a/src/testdir/test_search.vim b/src/testdir/test_search.vim
index 0a5068175..c4178fdec 100644
--- a/src/testdir/test_search.vim
+++ b/src/testdir/test_search.vim
@@ -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
diff --git a/src/testdir/test_search_stat.vim b/src/testdir/test_search_stat.vim
index b2a81070b..59d21c4e7 100644
--- a/src/testdir/test_search_stat.vim
+++ b/src/testdir/test_search_stat.vim
@@ -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>")
diff --git a/src/testdir/test_tabpanel.vim b/src/testdir/test_tabpanel.vim
index 427360aed..0f6aa0b56 100644
--- a/src/testdir/test_tabpanel.vim
+++ b/src/testdir/test_tabpanel.vim
@@ -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")
diff --git a/src/testdir/test_vim9_cmd.vim b/src/testdir/test_vim9_cmd.vim
index 22f33edf5..b54a58b50 100644
--- a/src/testdir/test_vim9_cmd.vim
+++ b/src/testdir/test_vim9_cmd.vim
@@ -952,7 +952,7 @@ func Test_command_modifier_confirm()
call term_sendkeys(buf, ":call Getout()
")
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)
diff --git a/src/testdir/test_visual.vim b/src/testdir/test_visual.vim
index ac27354d4..d92f651d9 100644
--- a/src/testdir/test_visual.vim
+++ b/src/testdir/test_visual.vim
@@ -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$")
diff --git a/src/version.c b/src/version.c
index 41c175369..8d6be2e96 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 */
+/**/
+ 392,
/**/
391,
/**/