mirror of
https://github.com/neovim/neovim.git
synced 2026-07-09 19:09:39 +00:00
vim-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: vim/vim#20050
1940bcb243
Co-authored-by: Christian Brabandt <cb@256bit.org>
This commit is contained in:
@@ -1030,6 +1030,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', {})
|
||||
|
||||
@@ -513,14 +513,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
|
||||
|
||||
|
||||
@@ -263,6 +263,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)
|
||||
|
||||
@@ -2087,6 +2087,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>")
|
||||
|
||||
@@ -775,6 +775,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
|
||||
|
||||
@@ -25,6 +25,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)
|
||||
|
||||
@@ -995,6 +995,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>")
|
||||
|
||||
@@ -2119,6 +2120,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
|
||||
|
||||
@@ -412,16 +412,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>")
|
||||
|
||||
@@ -1321,10 +1321,11 @@ func Test_visual_block_with_virtualedit()
|
||||
set virtualedit=block
|
||||
normal G
|
||||
END
|
||||
call writefile(lines, 'XTest_block')
|
||||
call writefile(lines, 'XTest_block', 'D')
|
||||
|
||||
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$")
|
||||
@@ -1333,7 +1334,6 @@ func Test_visual_block_with_virtualedit()
|
||||
" clean up
|
||||
call term_sendkeys(buf, "\<Esc>")
|
||||
call StopVimInTerminal(buf)
|
||||
call delete('XTest_block')
|
||||
endfunc
|
||||
|
||||
func Test_visual_block_ctrl_w_f()
|
||||
|
||||
Reference in New Issue
Block a user