aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorzeertzjq <zeertzjq@outlook.com>2023-08-23 00:00:57 +0800
committerGitHub <noreply@github.com>2023-08-23 00:00:57 +0800
commit20f76ebf2b5aec799b0f90e5e892a4b88597d427 (patch)
tree33fcb546d0e2e3b93969ca1fbdccf8f19ecd2b35
parentb84a67f50ed6141f72d433094a1a611ae4f67924 (diff)
downloadrneovim-20f76ebf2b5aec799b0f90e5e892a4b88597d427.tar.gz
rneovim-20f76ebf2b5aec799b0f90e5e892a4b88597d427.tar.bz2
rneovim-20f76ebf2b5aec799b0f90e5e892a4b88597d427.zip
test: fix state() test flakiness (#24839)
-rw-r--r--test/functional/vimscript/state_spec.lua10
1 files changed, 6 insertions, 4 deletions
diff --git a/test/functional/vimscript/state_spec.lua b/test/functional/vimscript/state_spec.lua
index 70f68a7494..1acfb1337d 100644
--- a/test/functional/vimscript/state_spec.lua
+++ b/test/functional/vimscript/state_spec.lua
@@ -41,18 +41,20 @@ describe('state() function', function()
-- Using a timer callback
feed([[:call RunTimer()<CR>]])
- poke_eventloop() -- Allow polling for events
+ poke_eventloop() -- Process pending input
+ poke_eventloop() -- Process time_event
eq({ 'c', 'n' }, exec_lua('return _G.res'))
-- Halfway a mapping
feed([[:call v:lua.Run_timer()<CR>;]])
- meths.get_mode() -- Allow polling for fast events
+ meths.get_mode() -- Process pending input and luv timer callback
feed(';')
eq({ 'mS', 'n' }, exec_lua('return _G.res'))
-- Insert mode completion
feed([[:call RunTimer()<CR>Got<C-N>]])
- poke_eventloop() -- Allow polling for events
+ poke_eventloop() -- Process pending input
+ poke_eventloop() -- Process time_event
feed('<Esc>')
eq({ 'aSc', 'i' }, exec_lua('return _G.res'))
@@ -62,7 +64,7 @@ describe('state() function', function()
-- messages scrolled
feed([[:call v:lua.Run_timer() | echo "one\ntwo\nthree"<CR>]])
- meths.get_mode() -- Allow polling for fast events
+ meths.get_mode() -- Process pending input and luv timer callback
feed('<CR>')
eq({ 'Ss', 'r' }, exec_lua('return _G.res'))
end)