diff src/testdir/test_functions.vim @ 19954:c087099e9163 v8.2.0533

patch 8.2.0533: tests using term_wait() can still be flaky Commit: https://github.com/vim/vim/commit/6a2c5a7dd5c9215cc030d5ea6e4616d782c091dd Author: Bram Moolenaar <Bram@vim.org> Date: Wed Apr 8 21:50:25 2020 +0200 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 #5899) Halve the initial times to make tests run faster when there is no rerun.
author Bram Moolenaar <Bram@vim.org>
date Wed, 08 Apr 2020 22:00:05 +0200
parents 82ea10d554fb
children e82996ad131f
line wrap: on
line diff
--- a/src/testdir/test_functions.vim
+++ b/src/testdir/test_functions.vim
@@ -1858,15 +1858,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
@@ -1888,27 +1879,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)
 
@@ -1916,7 +1907,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)