mirror of
https://github.com/neovim/neovim.git
synced 2025-12-18 12:25:34 +00:00
test/functional: sleep()
This commit is contained in:
@@ -300,14 +300,18 @@ local function curbuf(method, ...)
|
|||||||
end
|
end
|
||||||
|
|
||||||
local function wait()
|
local function wait()
|
||||||
|
-- Execute 'vim_eval' (a deferred function) to block
|
||||||
|
-- until all pending input is processed.
|
||||||
session:request('vim_eval', '1')
|
session:request('vim_eval', '1')
|
||||||
end
|
end
|
||||||
|
|
||||||
|
-- sleeps the test runner (_not_ the nvim instance)
|
||||||
|
local function sleep(timeout)
|
||||||
|
run(nil, nil, nil, timeout)
|
||||||
|
end
|
||||||
|
|
||||||
local function curbuf_contents()
|
local function curbuf_contents()
|
||||||
-- Before inspecting the buffer, execute 'vim_eval' to wait until all
|
wait() -- Before inspecting the buffer, process all input.
|
||||||
-- previously sent keys are processed(vim_eval is a deferred function, and
|
|
||||||
-- only processed after all input)
|
|
||||||
wait()
|
|
||||||
return table.concat(curbuf('get_lines', 0, -1, true), '\n')
|
return table.concat(curbuf('get_lines', 0, -1, true), '\n')
|
||||||
end
|
end
|
||||||
|
|
||||||
@@ -441,6 +445,7 @@ return function(after_each)
|
|||||||
curtab = curtab,
|
curtab = curtab,
|
||||||
curbuf_contents = curbuf_contents,
|
curbuf_contents = curbuf_contents,
|
||||||
wait = wait,
|
wait = wait,
|
||||||
|
sleep = sleep,
|
||||||
set_session = set_session,
|
set_session = set_session,
|
||||||
write_file = write_file,
|
write_file = write_file,
|
||||||
os_name = os_name,
|
os_name = os_name,
|
||||||
|
|||||||
Reference in New Issue
Block a user