aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorzeertzjq <zeertzjq@outlook.com>2023-08-21 14:45:33 +0800
committerzeertzjq <zeertzjq@outlook.com>2023-08-21 15:31:21 +0800
commitff37916b47658d16cdec6932aa8aaa3b5af674b7 (patch)
tree04b1f9ca72137021155c82ae32e593d55a24e477
parent045cc185d5d7575515dafebffc3ea3e2a7023e4e (diff)
downloadrneovim-ff37916b47658d16cdec6932aa8aaa3b5af674b7.tar.gz
rneovim-ff37916b47658d16cdec6932aa8aaa3b5af674b7.tar.bz2
rneovim-ff37916b47658d16cdec6932aa8aaa3b5af674b7.zip
vim-patch:8.2.0454: some tests fail when the system is slow
Problem: Some tests fail when the system is slow. Solution: Make the run number global, use in the test to increase the waiting time. (closes vim/vim#5841) https://github.com/vim/vim/commit/3ed9efc2b15b624268bcce4e4d312fb35840a12b Co-authored-by: Bram Moolenaar <Bram@vim.org>
-rw-r--r--test/old/testdir/test_functions.vim22
1 files changed, 16 insertions, 6 deletions
diff --git a/test/old/testdir/test_functions.vim b/test/old/testdir/test_functions.vim
index 5981b5214b..ba8134cc2d 100644
--- a/test/old/testdir/test_functions.vim
+++ b/test/old/testdir/test_functions.vim
@@ -2568,6 +2568,17 @@ 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
call setline(1, ['one', 'two', 'three'])
map ;; gg
@@ -2587,28 +2598,27 @@ func Test_state()
" Using a timer callback
call term_sendkeys(buf, ":call RunTimer()\<CR>")
- call term_wait(buf, 50)
- let getstate = ":echo 'state: ' .. g:state .. '; mode: ' .. g:mode\<CR>"
+ call term_wait(buf, wait_time)
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, 50)
+ call term_wait(buf, wait_time)
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, 200)
+ call term_wait(buf, wait_time)
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, 50)
+ call term_wait(buf, wait_time)
call term_sendkeys(buf, getstate)
call WaitForAssert({-> assert_match('state: xS; mode: n', term_getline(buf, 6))}, 1000)
@@ -2616,7 +2626,7 @@ func Test_state()
" messages scrolled
call term_sendkeys(buf, ":call RunTimer()\<CR>:echo \"one\\ntwo\\nthree\"\<CR>")
- call term_wait(buf, 50)
+ call term_wait(buf, wait_time)
call term_sendkeys(buf, "\<CR>")
call term_sendkeys(buf, getstate)
call WaitForAssert({-> assert_match('state: Scs; mode: r', term_getline(buf, 6))}, 1000)