summaryrefslogtreecommitdiff
path: root/src/testdir/test_autocmd.vim
diff options
context:
space:
mode:
authorBram Moolenaar <Bram@vim.org>2020-07-21 19:44:47 +0200
committerBram Moolenaar <Bram@vim.org>2020-07-21 19:44:47 +0200
commit7591116acffc45b5880c49244646651badac1629 (patch)
tree16e4659d7fb41d8cad4944fd9905a09c04d0d895 /src/testdir/test_autocmd.vim
parentf56c95fdad5af521887f8cd7bc15729b5355231d (diff)
downloadvim-git-7591116acffc45b5880c49244646651badac1629.tar.gz
patch 8.2.1260: there is no good test for CursorHoldv8.2.1260
Problem: There is no good test for CursorHold. Solution: Add a test. Remove duplicated test. (Yegappan Lakshmanan, closes #6503
Diffstat (limited to 'src/testdir/test_autocmd.vim')
-rw-r--r--src/testdir/test_autocmd.vim29
1 files changed, 29 insertions, 0 deletions
diff --git a/src/testdir/test_autocmd.vim b/src/testdir/test_autocmd.vim
index c167ed951..70fbe01c0 100644
--- a/src/testdir/test_autocmd.vim
+++ b/src/testdir/test_autocmd.vim
@@ -19,6 +19,35 @@ func Test_vim_did_enter()
" becomes one.
endfunc
+" Test for the CursorHold autocmd
+func Test_CursorHold_autocmd()
+ CheckRunVimInTerminal
+ call writefile(['one', 'two', 'three'], 'Xfile')
+ let before =<< trim END
+ set updatetime=10
+ au CursorHold * call writefile([line('.')], 'Xoutput', 'a')
+ END
+ call writefile(before, 'Xinit')
+ let buf = RunVimInTerminal('-S Xinit Xfile', {})
+ call term_wait(buf)
+ call term_sendkeys(buf, "gg")
+ call term_wait(buf)
+ sleep 50m
+ call term_sendkeys(buf, "j")
+ call term_wait(buf)
+ sleep 50m
+ call term_sendkeys(buf, "j")
+ call term_wait(buf)
+ sleep 50m
+ call StopVimInTerminal(buf)
+
+ call assert_equal(['1', '2', '3'], readfile('Xoutput')[-3:-1])
+
+ call delete('Xinit')
+ call delete('Xoutput')
+ call delete('Xfile')
+endfunc
+
if has('timers')
func ExitInsertMode(id)