patch 8.2.1498: on slow systems tests can be flaky
Problem: On slow systems tests can be flaky.
Solution: Use TermWait() instead of term-wait(). (Yegappan Lakshmanan,
closes #6756)
diff --git a/src/testdir/test_writefile.vim b/src/testdir/test_writefile.vim
index a6250c5..a1cf686 100644
--- a/src/testdir/test_writefile.vim
+++ b/src/testdir/test_writefile.vim
@@ -268,9 +268,9 @@
call writefile(["Line1", "Line2"], 'Xfile')
let old_ftime = getftime('Xfile')
let buf = RunVimInTerminal('Xfile', #{rows : 10})
- call term_wait(buf)
+ call TermWait(buf)
call term_sendkeys(buf, ":set noswapfile\<CR>")
- call term_wait(buf)
+ call TermWait(buf)
" Modify the file directly. Make sure the file modification time is
" different. Note that on Linux/Unix, the file is considered modified
@@ -286,17 +286,17 @@
" Try to overwrite the file and check for the prompt
call term_sendkeys(buf, ":w\<CR>")
- call term_wait(buf)
+ call TermWait(buf)
call WaitForAssert({-> assert_equal("WARNING: The file has been changed since reading it!!!", term_getline(buf, 9))})
call assert_equal("Do you really want to write to it (y/n)?",
\ term_getline(buf, 10))
call term_sendkeys(buf, "n\<CR>")
- call term_wait(buf)
+ call TermWait(buf)
call assert_equal(new_ftime, getftime('Xfile'))
call term_sendkeys(buf, ":w\<CR>")
- call term_wait(buf)
+ call TermWait(buf)
call term_sendkeys(buf, "y\<CR>")
- call term_wait(buf)
+ call TermWait(buf)
call WaitForAssert({-> assert_equal('Line2', readfile('Xfile')[1])})
" clean up
@@ -671,7 +671,7 @@
set cpoptions-=S
let &fileencoding = save_fileencoding
call delete('Xtest1')
- call delete('Xtest2')
+ call delete('Xfile2')
call delete('Xtest3')
%bw!
endfunc