aboutsummaryrefslogtreecommitdiff
path: root/test/functional/helpers.lua
diff options
context:
space:
mode:
authorJustin M. Keyes <justinkz@gmail.com>2016-06-22 02:18:21 -0400
committerJustin M. Keyes <justinkz@gmail.com>2016-07-03 02:22:55 -0400
commit086aa992927f29cb7bc5a74e9dcf801ec3a61fcf (patch)
tree82bf9126f8271eabe55db9edb783355dea57b93f /test/functional/helpers.lua
parentc402f6e7a9135490a9f05e4cac733e41c6815b2d (diff)
downloadrneovim-086aa992927f29cb7bc5a74e9dcf801ec3a61fcf.tar.gz
rneovim-086aa992927f29cb7bc5a74e9dcf801ec3a61fcf.tar.bz2
rneovim-086aa992927f29cb7bc5a74e9dcf801ec3a61fcf.zip
test/functional: sleep()
Diffstat (limited to 'test/functional/helpers.lua')
-rw-r--r--test/functional/helpers.lua13
1 files changed, 9 insertions, 4 deletions
diff --git a/test/functional/helpers.lua b/test/functional/helpers.lua
index 6e750b31a9..02109d0889 100644
--- a/test/functional/helpers.lua
+++ b/test/functional/helpers.lua
@@ -300,14 +300,18 @@ local function curbuf(method, ...)
end
local function wait()
+ -- Execute 'vim_eval' (a deferred function) to block
+ -- until all pending input is processed.
session:request('vim_eval', '1')
end
+-- sleeps the test runner (_not_ the nvim instance)
+local function sleep(timeout)
+ run(nil, nil, nil, timeout)
+end
+
local function curbuf_contents()
- -- Before inspecting the buffer, execute 'vim_eval' to wait until all
- -- previously sent keys are processed(vim_eval is a deferred function, and
- -- only processed after all input)
- wait()
+ wait() -- Before inspecting the buffer, process all input.
return table.concat(curbuf('get_lines', 0, -1, true), '\n')
end
@@ -441,6 +445,7 @@ return function(after_each)
curtab = curtab,
curbuf_contents = curbuf_contents,
wait = wait,
+ sleep = sleep,
set_session = set_session,
write_file = write_file,
os_name = os_name,