mirror of
https://github.com/neovim/neovim
synced 2025-07-16 01:01:49 +00:00
vim-patch:8.2.0533: tests using term_wait() can still be flaky
Problem: Tests using term_wait() can still be flaky.
Solution: Increase the wait time when rerunning a test. (James McCoy,
closes vim/vim#5899) Halve the initial times to make tests run faster
when there is no rerun.
6a2c5a7dd5
Co-authored-by: Bram Moolenaar <Bram@vim.org>
This commit is contained in:
@ -571,7 +571,7 @@ func Test_quit_with_arglist()
|
||||
call term_sendkeys(buf, ":set nomore\n")
|
||||
call term_sendkeys(buf, ":args a b c\n")
|
||||
call term_sendkeys(buf, ":quit\n")
|
||||
call term_wait(buf)
|
||||
call TermWait(buf)
|
||||
call WaitForAssert({-> assert_match('^E173:', term_getline(buf, 6))})
|
||||
call StopVimInTerminal(buf)
|
||||
|
||||
@ -580,16 +580,16 @@ func Test_quit_with_arglist()
|
||||
call term_sendkeys(buf, ":set nomore\n")
|
||||
call term_sendkeys(buf, ":args a b c\n")
|
||||
call term_sendkeys(buf, ":confirm quit\n")
|
||||
call term_wait(buf)
|
||||
call TermWait(buf)
|
||||
call WaitForAssert({-> assert_match('^\[Y\]es, (N)o: *$',
|
||||
\ term_getline(buf, 6))})
|
||||
call term_sendkeys(buf, "N")
|
||||
call term_wait(buf)
|
||||
call TermWait(buf)
|
||||
call term_sendkeys(buf, ":confirm quit\n")
|
||||
call WaitForAssert({-> assert_match('^\[Y\]es, (N)o: *$',
|
||||
\ term_getline(buf, 6))})
|
||||
call term_sendkeys(buf, "Y")
|
||||
call term_wait(buf)
|
||||
call TermWait(buf)
|
||||
call WaitForAssert({-> assert_equal("finished", term_getstatus(buf))})
|
||||
only!
|
||||
" When this test fails, swap files are left behind which breaks subsequent
|
||||
|
@ -2984,9 +2984,9 @@ func Test_autocmd_SafeState()
|
||||
call WaitForAssert({-> assert_match('^xxx', term_getline(buf, 6))}, 1000)
|
||||
|
||||
call term_sendkeys(buf, ":let g:again = ''\<CR>:call CallTimer()\<CR>")
|
||||
call term_wait(buf, 100)
|
||||
call TermWait(buf, 50)
|
||||
call term_sendkeys(buf, ":\<CR>")
|
||||
call term_wait(buf, 100)
|
||||
call TermWait(buf, 50)
|
||||
call term_sendkeys(buf, ":echo g:again\<CR>")
|
||||
call WaitForAssert({-> assert_match('xtx', term_getline(buf, 6))}, 1000)
|
||||
|
||||
@ -3010,7 +3010,7 @@ func Test_autocmd_CmdWinEnter()
|
||||
let buf = RunVimInTerminal('-S '.filename, #{rows: 6})
|
||||
|
||||
call term_sendkeys(buf, "q:")
|
||||
call term_wait(buf)
|
||||
call TermWait(buf)
|
||||
call term_sendkeys(buf, ":echo b:dummy_var\<cr>")
|
||||
call WaitForAssert({-> assert_match('^This is a dummy', term_getline(buf, 6))}, 2000)
|
||||
call term_sendkeys(buf, ":echo &buftype\<cr>")
|
||||
|
@ -217,7 +217,7 @@ func Test_appendbufline_redraw()
|
||||
END
|
||||
call writefile(lines, 'XscriptMatchCommon')
|
||||
let buf = RunVimInTerminal('-S XscriptMatchCommon', #{rows: 10})
|
||||
call term_wait(buf)
|
||||
call TermWait(buf)
|
||||
call VerifyScreenDump(buf, 'Test_appendbufline_1', {})
|
||||
|
||||
call StopVimInTerminal(buf)
|
||||
|
@ -1482,7 +1482,7 @@ func Test_verbose_option()
|
||||
call writefile(lines, 'XTest_verbose')
|
||||
|
||||
let buf = RunVimInTerminal('-S XTest_verbose', {'rows': 12})
|
||||
call term_wait(buf, 100)
|
||||
call TermWait(buf, 50)
|
||||
call term_sendkeys(buf, ":DoSomething\<CR>")
|
||||
call VerifyScreenDump(buf, 'Test_verbose_option_1', {})
|
||||
|
||||
@ -1560,7 +1560,7 @@ func Test_cmdwin_restore()
|
||||
call writefile(lines, 'XTest_restore')
|
||||
|
||||
let buf = RunVimInTerminal('-S XTest_restore', {'rows': 12})
|
||||
call term_wait(buf, 100)
|
||||
call TermWait(buf, 50)
|
||||
call term_sendkeys(buf, "q:")
|
||||
call VerifyScreenDump(buf, 'Test_cmdwin_restore_1', {})
|
||||
|
||||
@ -1687,7 +1687,7 @@ func Test_cmdlineclear_tabenter()
|
||||
|
||||
call writefile(lines, 'XtestCmdlineClearTabenter')
|
||||
let buf = RunVimInTerminal('-S XtestCmdlineClearTabenter', #{rows: 10})
|
||||
call term_wait(buf, 50)
|
||||
call TermWait(buf, 25)
|
||||
" in one tab make the command line higher with CTRL-W -
|
||||
call term_sendkeys(buf, ":tabnew\<cr>\<C-w>-\<C-w>-gtgt")
|
||||
call VerifyScreenDump(buf, 'Test_cmdlineclear_tabenter', {})
|
||||
|
@ -136,41 +136,41 @@ func Test_cursorline_screenline()
|
||||
call writefile(lines, filename)
|
||||
" basic test
|
||||
let buf = RunVimInTerminal('-S '. filename, #{rows: 20})
|
||||
call term_wait(buf)
|
||||
call TermWait(buf)
|
||||
call VerifyScreenDump(buf, 'Test_'. filename. '_1', {})
|
||||
call term_sendkeys(buf, "fagj")
|
||||
call term_wait(buf)
|
||||
call TermWait(buf)
|
||||
call VerifyScreenDump(buf, 'Test_'. filename. '_2', {})
|
||||
call term_sendkeys(buf, "gj")
|
||||
call term_wait(buf)
|
||||
call TermWait(buf)
|
||||
call VerifyScreenDump(buf, 'Test_'. filename. '_3', {})
|
||||
call term_sendkeys(buf, "gj")
|
||||
call term_wait(buf)
|
||||
call TermWait(buf)
|
||||
call VerifyScreenDump(buf, 'Test_'. filename. '_4', {})
|
||||
call term_sendkeys(buf, "gj")
|
||||
call term_wait(buf)
|
||||
call TermWait(buf)
|
||||
call VerifyScreenDump(buf, 'Test_'. filename. '_5', {})
|
||||
call term_sendkeys(buf, "gj")
|
||||
call term_wait(buf)
|
||||
call TermWait(buf)
|
||||
call VerifyScreenDump(buf, 'Test_'. filename. '_6', {})
|
||||
" test with set list and cursorlineopt containing number
|
||||
call term_sendkeys(buf, "gg0")
|
||||
call term_sendkeys(buf, ":set list cursorlineopt+=number listchars=space:-\<cr>")
|
||||
call VerifyScreenDump(buf, 'Test_'. filename. '_7', {})
|
||||
call term_sendkeys(buf, "fagj")
|
||||
call term_wait(buf)
|
||||
call TermWait(buf)
|
||||
call VerifyScreenDump(buf, 'Test_'. filename. '_8', {})
|
||||
call term_sendkeys(buf, "gj")
|
||||
call term_wait(buf)
|
||||
call TermWait(buf)
|
||||
call VerifyScreenDump(buf, 'Test_'. filename. '_9', {})
|
||||
call term_sendkeys(buf, "gj")
|
||||
call term_wait(buf)
|
||||
call TermWait(buf)
|
||||
call VerifyScreenDump(buf, 'Test_'. filename. '_10', {})
|
||||
call term_sendkeys(buf, "gj")
|
||||
call term_wait(buf)
|
||||
call TermWait(buf)
|
||||
call VerifyScreenDump(buf, 'Test_'. filename. '_11', {})
|
||||
call term_sendkeys(buf, "gj")
|
||||
call term_wait(buf)
|
||||
call TermWait(buf)
|
||||
call VerifyScreenDump(buf, 'Test_'. filename. '_12', {})
|
||||
if exists("+foldcolumn") && exists("+signcolumn") && exists("+breakindent")
|
||||
" test with set foldcolumn signcoloumn and breakindent
|
||||
@ -178,19 +178,19 @@ func Test_cursorline_screenline()
|
||||
call term_sendkeys(buf, ":set breakindent foldcolumn=2 signcolumn=yes\<cr>")
|
||||
call VerifyScreenDump(buf, 'Test_'. filename. '_13', {})
|
||||
call term_sendkeys(buf, "fagj")
|
||||
call term_wait(buf)
|
||||
call TermWait(buf)
|
||||
call VerifyScreenDump(buf, 'Test_'. filename. '_14', {})
|
||||
call term_sendkeys(buf, "gj")
|
||||
call term_wait(buf)
|
||||
call TermWait(buf)
|
||||
call VerifyScreenDump(buf, 'Test_'. filename. '_15', {})
|
||||
call term_sendkeys(buf, "gj")
|
||||
call term_wait(buf)
|
||||
call TermWait(buf)
|
||||
call VerifyScreenDump(buf, 'Test_'. filename. '_16', {})
|
||||
call term_sendkeys(buf, "gj")
|
||||
call term_wait(buf)
|
||||
call TermWait(buf)
|
||||
call VerifyScreenDump(buf, 'Test_'. filename. '_17', {})
|
||||
call term_sendkeys(buf, "gj")
|
||||
call term_wait(buf)
|
||||
call TermWait(buf)
|
||||
call VerifyScreenDump(buf, 'Test_'. filename. '_18', {})
|
||||
call term_sendkeys(buf, ":set breakindent& foldcolumn& signcolumn&\<cr>")
|
||||
endif
|
||||
|
@ -36,7 +36,7 @@ endfunc
|
||||
" If the expected output argument is supplied, then check for it.
|
||||
func RunDbgCmd(buf, cmd, ...)
|
||||
call term_sendkeys(a:buf, a:cmd . "\r")
|
||||
call term_wait(a:buf, 20)
|
||||
call TermWait(a:buf)
|
||||
|
||||
if a:0 != 0
|
||||
let options = #{match: 'equal'}
|
||||
|
@ -177,7 +177,7 @@ func Test_scroll_CursorLineNr_update()
|
||||
call writefile(lines, filename)
|
||||
let buf = RunVimInTerminal('-S '.filename, #{rows: 5, cols: 50})
|
||||
call term_sendkeys(buf, "k")
|
||||
call term_wait(buf)
|
||||
call TermWait(buf)
|
||||
call VerifyScreenDump(buf, 'Test_winline_rnu', {})
|
||||
|
||||
" clean up
|
||||
|
@ -2568,15 +2568,6 @@ endfunc
|
||||
func Test_state()
|
||||
CheckRunVimInTerminal
|
||||
|
||||
" In the first run try a short wait time. If the test fails retry with a
|
||||
" longer wait time.
|
||||
if g:run_nr == 1
|
||||
let wait_time = 50
|
||||
elseif g:run_nr == 2
|
||||
let wait_time = 200
|
||||
else
|
||||
let wait_time = 500
|
||||
endif
|
||||
let getstate = ":echo 'state: ' .. g:state .. '; mode: ' .. g:mode\<CR>"
|
||||
|
||||
let lines =<< trim END
|
||||
@ -2598,27 +2589,27 @@ func Test_state()
|
||||
|
||||
" Using a timer callback
|
||||
call term_sendkeys(buf, ":call RunTimer()\<CR>")
|
||||
call term_wait(buf, wait_time)
|
||||
call TermWait(buf, 25)
|
||||
call term_sendkeys(buf, getstate)
|
||||
call WaitForAssert({-> assert_match('state: c; mode: n', term_getline(buf, 6))}, 1000)
|
||||
|
||||
" Halfway a mapping
|
||||
call term_sendkeys(buf, ":call RunTimer()\<CR>;")
|
||||
call term_wait(buf, wait_time)
|
||||
call TermWait(buf, 25)
|
||||
call term_sendkeys(buf, ";")
|
||||
call term_sendkeys(buf, getstate)
|
||||
call WaitForAssert({-> assert_match('state: mSc; mode: n', term_getline(buf, 6))}, 1000)
|
||||
|
||||
" Insert mode completion (bit slower on Mac)
|
||||
call term_sendkeys(buf, ":call RunTimer()\<CR>Got\<C-N>")
|
||||
call term_wait(buf, wait_time)
|
||||
call TermWait(buf, 25)
|
||||
call term_sendkeys(buf, "\<Esc>")
|
||||
call term_sendkeys(buf, getstate)
|
||||
call WaitForAssert({-> assert_match('state: aSc; mode: i', term_getline(buf, 6))}, 1000)
|
||||
|
||||
" Autocommand executing
|
||||
call term_sendkeys(buf, ":set filetype=foobar\<CR>")
|
||||
call term_wait(buf, wait_time)
|
||||
call TermWait(buf, 25)
|
||||
call term_sendkeys(buf, getstate)
|
||||
call WaitForAssert({-> assert_match('state: xS; mode: n', term_getline(buf, 6))}, 1000)
|
||||
|
||||
@ -2626,7 +2617,7 @@ func Test_state()
|
||||
|
||||
" messages scrolled
|
||||
call term_sendkeys(buf, ":call RunTimer()\<CR>:echo \"one\\ntwo\\nthree\"\<CR>")
|
||||
call term_wait(buf, wait_time)
|
||||
call TermWait(buf, 25)
|
||||
call term_sendkeys(buf, "\<CR>")
|
||||
call term_sendkeys(buf, getstate)
|
||||
call WaitForAssert({-> assert_match('state: Scs; mode: r', term_getline(buf, 6))}, 1000)
|
||||
|
@ -543,9 +543,9 @@ func Test_cursorline_after_yank()
|
||||
\ 'call setline(1, ["","1","2","3",""])',
|
||||
\ ], 'Xtest_cursorline_yank')
|
||||
let buf = RunVimInTerminal('-S Xtest_cursorline_yank', {'rows': 8})
|
||||
call term_wait(buf)
|
||||
call TermWait(buf)
|
||||
call term_sendkeys(buf, "Gy3k")
|
||||
call term_wait(buf)
|
||||
call TermWait(buf)
|
||||
call term_sendkeys(buf, "jj")
|
||||
|
||||
call VerifyScreenDump(buf, 'Test_cursorline_yank_01', {})
|
||||
@ -583,7 +583,7 @@ func Test_cursorline_with_visualmode()
|
||||
\ 'call setline(1, repeat(["abc"], 50))',
|
||||
\ ], 'Xtest_cursorline_with_visualmode')
|
||||
let buf = RunVimInTerminal('-S Xtest_cursorline_with_visualmode', {'rows': 12})
|
||||
call term_wait(buf)
|
||||
call TermWait(buf)
|
||||
call term_sendkeys(buf, "V\<C-f>kkkjk")
|
||||
|
||||
call VerifyScreenDump(buf, 'Test_cursorline_with_visualmode_01', {})
|
||||
@ -611,9 +611,9 @@ func Test_wincolor()
|
||||
END
|
||||
call writefile(lines, 'Xtest_wincolor')
|
||||
let buf = RunVimInTerminal('-S Xtest_wincolor', {'rows': 8})
|
||||
call term_wait(buf)
|
||||
call TermWait(buf)
|
||||
call term_sendkeys(buf, "2G5lvj")
|
||||
call term_wait(buf)
|
||||
call TermWait(buf)
|
||||
|
||||
call VerifyScreenDump(buf, 'Test_wincolor_01', {})
|
||||
|
||||
@ -718,7 +718,7 @@ func Test_colorcolumn()
|
||||
call writefile(lines, 'Xtest_colorcolumn')
|
||||
let buf = RunVimInTerminal('-S Xtest_colorcolumn', {'rows': 10})
|
||||
call term_sendkeys(buf, ":\<CR>")
|
||||
call term_wait(buf)
|
||||
call TermWait(buf)
|
||||
call VerifyScreenDump(buf, 'Test_colorcolumn_1', {})
|
||||
|
||||
" clean up
|
||||
|
@ -620,7 +620,7 @@ func Test_pum_with_folds_two_tabs()
|
||||
|
||||
call writefile(lines, 'Xpumscript')
|
||||
let buf = RunVimInTerminal('-S Xpumscript', #{rows: 10})
|
||||
call term_wait(buf, 100)
|
||||
call TermWait(buf, 50)
|
||||
call term_sendkeys(buf, "a\<C-N>")
|
||||
call VerifyScreenDump(buf, 'Test_pum_with_folds_two_tabs', {})
|
||||
|
||||
@ -645,9 +645,9 @@ func Test_pum_with_preview_win()
|
||||
|
||||
call writefile(lines, 'Xpreviewscript')
|
||||
let buf = RunVimInTerminal('-S Xpreviewscript', #{rows: 12})
|
||||
call term_wait(buf, 100)
|
||||
call TermWait(buf, 50)
|
||||
call term_sendkeys(buf, "Gi\<C-X>\<C-O>")
|
||||
call term_wait(buf, 200)
|
||||
call TermWait(buf, 100)
|
||||
call term_sendkeys(buf, "\<C-N>")
|
||||
call VerifyScreenDump(buf, 'Test_pum_with_preview_win', {})
|
||||
|
||||
|
@ -418,9 +418,9 @@ func Test_error_in_map_expr()
|
||||
|
||||
" GC must not run during map-expr processing, which can make Vim crash.
|
||||
call term_sendkeys(buf, '!')
|
||||
call term_wait(buf, 100)
|
||||
call TermWait(buf, 50)
|
||||
call term_sendkeys(buf, "\<CR>")
|
||||
call term_wait(buf, 100)
|
||||
call TermWait(buf, 50)
|
||||
call assert_equal('run', job_status(job))
|
||||
|
||||
call term_sendkeys(buf, ":qall!\<CR>")
|
||||
|
@ -322,7 +322,7 @@ func OtherWindowCommon()
|
||||
END
|
||||
call writefile(lines, 'XscriptMatchCommon')
|
||||
let buf = RunVimInTerminal('-S XscriptMatchCommon', #{rows: 12})
|
||||
call term_wait(buf)
|
||||
call TermWait(buf)
|
||||
return buf
|
||||
endfunc
|
||||
|
||||
|
@ -372,14 +372,14 @@ func Test_cursor_column_in_concealed_line_after_window_scroll()
|
||||
END
|
||||
call writefile(lines, 'Xcolesearch')
|
||||
let buf = RunVimInTerminal('Xcolesearch', {})
|
||||
call term_wait(buf, 100)
|
||||
call TermWait(buf, 50)
|
||||
|
||||
" Jump to something that is beyond the bottom of the window,
|
||||
" so there's a scroll down.
|
||||
call term_sendkeys(buf, ":so %\<CR>")
|
||||
call term_wait(buf, 100)
|
||||
call TermWait(buf, 50)
|
||||
call term_sendkeys(buf, "/expr\<CR>")
|
||||
call term_wait(buf, 100)
|
||||
call TermWait(buf, 50)
|
||||
|
||||
" Are the concealed parts of the current line really hidden?
|
||||
let cursor_row = term_scrape(buf, '.')->map({_, e -> e.chars})->join('')
|
||||
@ -409,7 +409,7 @@ func Test_cursor_column_in_concealed_line_after_leftcol_change()
|
||||
" Horizontal scroll would center the cursor in the screen line, but conceal
|
||||
" makes it go to screen column 1.
|
||||
call term_sendkeys(buf, "$")
|
||||
call term_wait(buf)
|
||||
call TermWait(buf)
|
||||
|
||||
" Are the concealed parts of the current line really hidden?
|
||||
call WaitForAssert({-> assert_equal('c', term_getline(buf, '.'))})
|
||||
|
@ -112,7 +112,7 @@ func Test_mode_message_at_leaving_insert_by_ctrl_c()
|
||||
|
||||
let rows = 10
|
||||
let buf = term_start([GetVimProg(), '--clean', '-S', testfile], {'term_rows': rows})
|
||||
call term_wait(buf, 200)
|
||||
call TermWait(buf, 100)
|
||||
call assert_equal('run', job_status(term_getjob(buf)))
|
||||
|
||||
call term_sendkeys(buf, "i")
|
||||
@ -140,7 +140,7 @@ func Test_mode_message_at_leaving_insert_with_esc_mapped()
|
||||
|
||||
let rows = 10
|
||||
let buf = term_start([GetVimProg(), '--clean', '-S', testfile], {'term_rows': rows})
|
||||
call term_wait(buf, 200)
|
||||
call WaitForAssert({-> assert_match('0,0-1\s*All$', term_getline(buf, rows - 1))})
|
||||
call assert_equal('run', job_status(term_getjob(buf)))
|
||||
|
||||
call term_sendkeys(buf, "i")
|
||||
|
@ -280,7 +280,7 @@ func Test_relativenumber_colors()
|
||||
|
||||
" Check that the balloon shows up after a mouse move
|
||||
let buf = RunVimInTerminal('-S XTest_relnr', {'rows': 10, 'cols': 50})
|
||||
call term_wait(buf, 100)
|
||||
call TermWait(buf, 50)
|
||||
" Default colors
|
||||
call VerifyScreenDump(buf, 'Test_relnr_colors_1', {})
|
||||
|
||||
|
@ -691,11 +691,11 @@ func Test_popup_and_window_resize()
|
||||
|
||||
call term_sendkeys(buf, "Gi\<c-x>")
|
||||
call term_sendkeys(buf, "\<c-v>")
|
||||
call term_wait(buf, 100)
|
||||
call TermWait(buf, 50)
|
||||
" popup first entry "!" must be at the top
|
||||
call WaitForAssert({-> assert_match('^!\s*$', term_getline(buf, 1))})
|
||||
exe 'resize +' . (h - 1)
|
||||
call term_wait(buf, 100)
|
||||
call TermWait(buf, 50)
|
||||
redraw!
|
||||
" popup shifted down, first line is now empty
|
||||
call WaitForAssert({-> assert_equal('', term_getline(buf, 1))})
|
||||
@ -759,11 +759,11 @@ func Test_popup_and_previewwindow_dump()
|
||||
let buf = RunVimInTerminal('-S Xscript', {})
|
||||
|
||||
" wait for the script to finish
|
||||
call term_wait(buf)
|
||||
call TermWait(buf)
|
||||
|
||||
" Test that popup and previewwindow do not overlap.
|
||||
call term_sendkeys(buf, "o")
|
||||
call term_wait(buf, 100)
|
||||
call TermWait(buf, 50)
|
||||
call term_sendkeys(buf, "\<C-X>\<C-N>")
|
||||
call VerifyScreenDump(buf, 'Test_popup_and_previewwindow_01', {})
|
||||
|
||||
|
@ -584,7 +584,7 @@ func Test_profile_typed_func()
|
||||
\ .. "endfunc\<CR>")
|
||||
call term_sendkeys(buf, ":profile func DoSomething\<CR>")
|
||||
call term_sendkeys(buf, ":call DoSomething()\<CR>")
|
||||
call term_wait(buf, 200)
|
||||
call TermWait(buf, 100)
|
||||
call StopVimInTerminal(buf)
|
||||
let lines = readfile('XprofileTypedFunc')
|
||||
call assert_equal("FUNCTION DoSomething()", lines[0])
|
||||
|
@ -815,12 +815,12 @@ func Test_search_cmdline_incsearch_highlight_attr()
|
||||
|
||||
call WaitForAssert({-> assert_equal(lines, [term_getline(buf, 1), term_getline(buf, 2)])})
|
||||
" wait for vim to complete initialization
|
||||
call term_wait(buf)
|
||||
call TermWait(buf)
|
||||
|
||||
" Get attr of normal(a0), incsearch(a1), hlsearch(a2) highlight
|
||||
call term_sendkeys(buf, ":set incsearch hlsearch\<cr>")
|
||||
call term_sendkeys(buf, '/b')
|
||||
call term_wait(buf, 200)
|
||||
call TermWait(buf, 100)
|
||||
let screen_line1 = term_scrape(buf, 1)
|
||||
call assert_true(len(screen_line1) > 2)
|
||||
" a0: attr_normal
|
||||
@ -836,7 +836,7 @@ func Test_search_cmdline_incsearch_highlight_attr()
|
||||
|
||||
" Test incremental highlight search
|
||||
call term_sendkeys(buf, "/vim")
|
||||
call term_wait(buf, 200)
|
||||
call TermWait(buf, 100)
|
||||
" Buffer:
|
||||
" abb vim vim vi
|
||||
" vimvivim
|
||||
@ -848,7 +848,7 @@ func Test_search_cmdline_incsearch_highlight_attr()
|
||||
|
||||
" Test <C-g>
|
||||
call term_sendkeys(buf, "\<C-g>\<C-g>")
|
||||
call term_wait(buf, 200)
|
||||
call TermWait(buf, 100)
|
||||
let attr_line1 = [a0,a0,a0,a0,a2,a2,a2,a0,a2,a2,a2,a0,a0,a0]
|
||||
let attr_line2 = [a1,a1,a1,a0,a0,a2,a2,a2]
|
||||
call assert_equal(attr_line1, map(term_scrape(buf, 1)[:len(attr_line1)-1], 'v:val.attr'))
|
||||
@ -856,7 +856,7 @@ func Test_search_cmdline_incsearch_highlight_attr()
|
||||
|
||||
" Test <C-t>
|
||||
call term_sendkeys(buf, "\<C-t>")
|
||||
call term_wait(buf, 200)
|
||||
call TermWait(buf, 100)
|
||||
let attr_line1 = [a0,a0,a0,a0,a2,a2,a2,a0,a1,a1,a1,a0,a0,a0]
|
||||
let attr_line2 = [a2,a2,a2,a0,a0,a2,a2,a2]
|
||||
call assert_equal(attr_line1, map(term_scrape(buf, 1)[:len(attr_line1)-1], 'v:val.attr'))
|
||||
@ -864,7 +864,7 @@ func Test_search_cmdline_incsearch_highlight_attr()
|
||||
|
||||
" Type Enter and a1(incsearch highlight) should become a2(hlsearch highlight)
|
||||
call term_sendkeys(buf, "\<cr>")
|
||||
call term_wait(buf, 200)
|
||||
call TermWait(buf, 100)
|
||||
let attr_line1 = [a0,a0,a0,a0,a2,a2,a2,a0,a2,a2,a2,a0,a0,a0]
|
||||
let attr_line2 = [a2,a2,a2,a0,a0,a2,a2,a2]
|
||||
call assert_equal(attr_line1, map(term_scrape(buf, 1)[:len(attr_line1)-1], 'v:val.attr'))
|
||||
@ -874,7 +874,7 @@ func Test_search_cmdline_incsearch_highlight_attr()
|
||||
call term_sendkeys(buf, ":1\<cr>")
|
||||
call term_sendkeys(buf, ":set nohlsearch\<cr>")
|
||||
call term_sendkeys(buf, "/vim")
|
||||
call term_wait(buf, 200)
|
||||
call TermWait(buf, 100)
|
||||
let attr_line1 = [a0,a0,a0,a0,a1,a1,a1,a0,a0,a0,a0,a0,a0,a0]
|
||||
let attr_line2 = [a0,a0,a0,a0,a0,a0,a0,a0]
|
||||
call assert_equal(attr_line1, map(term_scrape(buf, 1)[:len(attr_line1)-1], 'v:val.attr'))
|
||||
|
@ -364,12 +364,12 @@ func! Test_search_stat_screendump()
|
||||
END
|
||||
call writefile(lines, 'Xsearchstat')
|
||||
let buf = RunVimInTerminal('-S Xsearchstat', #{rows: 10})
|
||||
call term_wait(buf)
|
||||
call TermWait(buf)
|
||||
call VerifyScreenDump(buf, 'Test_searchstat_1', {})
|
||||
|
||||
call term_sendkeys(buf, ":nnoremap <silent> n n\<cr>")
|
||||
call term_sendkeys(buf, "gg0n")
|
||||
call term_wait(buf)
|
||||
call TermWait(buf)
|
||||
call VerifyScreenDump(buf, 'Test_searchstat_2', {})
|
||||
|
||||
call StopVimInTerminal(buf)
|
||||
|
@ -960,9 +960,9 @@ func Test_missing_vimrc()
|
||||
let cmd = GetVimCommandCleanTerm() . ' -u Xvimrc_missing -S Xafter'
|
||||
let buf = term_start(cmd, {'term_rows' : 10})
|
||||
call WaitForAssert({-> assert_equal("running", term_getstatus(buf))})
|
||||
call term_wait(buf)
|
||||
call TermWait(buf)
|
||||
call term_sendkeys(buf, "\n:")
|
||||
call term_wait(buf)
|
||||
call TermWait(buf)
|
||||
call WaitForAssert({-> assert_match(':', term_getline(buf, 10))})
|
||||
call StopVimInTerminal(buf)
|
||||
call assert_equal([], readfile('Xtestout'))
|
||||
|
@ -73,7 +73,7 @@ func Test_detect_ambiwidth()
|
||||
\ 'redraw',
|
||||
\ ], 'Xscript')
|
||||
let buf = RunVimInTerminal('-S Xscript', #{keep_t_u7: 1})
|
||||
call term_wait(buf)
|
||||
call TermWait(buf)
|
||||
call term_sendkeys(buf, "S\<C-R>=&ambiwidth\<CR>\<Esc>")
|
||||
call WaitForAssert({-> assert_match('single', term_getline(buf, 1))})
|
||||
|
||||
|
@ -53,7 +53,7 @@ func Test_suspend()
|
||||
|
||||
" Quit gracefully to dump coverage information.
|
||||
call term_sendkeys(buf, ":qall!\<CR>")
|
||||
call term_wait(buf)
|
||||
call TermWait(buf)
|
||||
" Wait until Vim actually exited and shell shows a prompt
|
||||
call WaitForAssert({-> assert_match('[$#] $', term_getline(buf, '.'))})
|
||||
call StopShellInTerminal(buf)
|
||||
|
@ -374,14 +374,14 @@ func Test_swap_prompt_splitwin()
|
||||
call term_sendkeys(buf, ":set noruler\n")
|
||||
|
||||
call term_sendkeys(buf, ":split Xfile1\n")
|
||||
call term_wait(buf)
|
||||
call TermWait(buf)
|
||||
call WaitForAssert({-> assert_match('^\[O\]pen Read-Only, (E)dit anyway, (R)ecover, (Q)uit, (A)bort: $', term_getline(buf, 20))})
|
||||
call term_sendkeys(buf, "q")
|
||||
call term_wait(buf)
|
||||
call TermWait(buf)
|
||||
call term_sendkeys(buf, ":\<CR>")
|
||||
call WaitForAssert({-> assert_match('^:$', term_getline(buf, 20))})
|
||||
call term_sendkeys(buf, ":echomsg winnr('$')\<CR>")
|
||||
call term_wait(buf)
|
||||
call TermWait(buf)
|
||||
call WaitForAssert({-> assert_match('^1$', term_getline(buf, 20))})
|
||||
call StopVimInTerminal(buf)
|
||||
|
||||
|
@ -671,7 +671,7 @@ func Test_tselect()
|
||||
call writefile(lines, 'XTest_tselect')
|
||||
let buf = RunVimInTerminal('-S XTest_tselect', {'rows': 10, 'cols': 50})
|
||||
|
||||
call term_wait(buf, 100)
|
||||
call TermWait(buf, 50)
|
||||
call term_sendkeys(buf, ":tselect main\<CR>2\<CR>")
|
||||
call VerifyScreenDump(buf, 'Test_tselect_1', {})
|
||||
|
||||
|
@ -386,9 +386,9 @@ func Test_timer_error_in_timer_callback()
|
||||
call WaitForAssert({-> assert_notequal('', term_getline(buf, 8))})
|
||||
|
||||
" GC must not run during timer callback, which can make Vim crash.
|
||||
call term_wait(buf, 100)
|
||||
call TermWait(buf, 50)
|
||||
call term_sendkeys(buf, "\<CR>")
|
||||
call term_wait(buf, 100)
|
||||
call TermWait(buf, 50)
|
||||
call assert_equal('run', job_status(job))
|
||||
|
||||
call term_sendkeys(buf, ":qall!\<CR>")
|
||||
|
@ -7249,30 +7249,30 @@ func Test_deep_nest()
|
||||
|
||||
" Deep nesting of if ... endif
|
||||
call term_sendkeys(buf, ":call Test1()\n")
|
||||
call term_wait(buf)
|
||||
call TermWait(buf)
|
||||
call WaitForAssert({-> assert_match('^E579:', term_getline(buf, 5))})
|
||||
|
||||
" Deep nesting of for ... endfor
|
||||
call term_sendkeys(buf, ":call Test2()\n")
|
||||
call term_wait(buf)
|
||||
call TermWait(buf)
|
||||
call WaitForAssert({-> assert_match('^E585:', term_getline(buf, 5))})
|
||||
|
||||
" Deep nesting of while ... endwhile
|
||||
call term_sendkeys(buf, ":call Test3()\n")
|
||||
call term_wait(buf)
|
||||
call TermWait(buf)
|
||||
call WaitForAssert({-> assert_match('^E585:', term_getline(buf, 5))})
|
||||
|
||||
" Deep nesting of try ... endtry
|
||||
call term_sendkeys(buf, ":call Test4()\n")
|
||||
call term_wait(buf)
|
||||
call TermWait(buf)
|
||||
call WaitForAssert({-> assert_match('^E601:', term_getline(buf, 5))})
|
||||
|
||||
" Deep nesting of function ... endfunction
|
||||
call term_sendkeys(buf, ":call Test5()\n")
|
||||
call term_wait(buf)
|
||||
call TermWait(buf)
|
||||
call WaitForAssert({-> assert_match('^E1058:', term_getline(buf, 4))})
|
||||
call term_sendkeys(buf, "\<C-C>\n")
|
||||
call term_wait(buf)
|
||||
call TermWait(buf)
|
||||
|
||||
"let l = ''
|
||||
"for i in range(1, 6)
|
||||
|
Reference in New Issue
Block a user