aboutsummaryrefslogtreecommitdiff
path: root/test/functional/helpers.lua
diff options
context:
space:
mode:
authorBjörn Linse <bjorn.linse@gmail.com>2017-12-09 11:26:06 +0100
committerBjörn Linse <bjorn.linse@gmail.com>2018-12-31 12:44:22 +0100
commit1f8afe15a4670b237a4e97d8038ddd75c7d9d227 (patch)
treead831df486bc209b7b650a4c164167e06fdc2c27 /test/functional/helpers.lua
parentf77f09ea6e0e540a636990df84d09166a757482f (diff)
downloadrneovim-1f8afe15a4670b237a4e97d8038ddd75c7d9d227.tar.gz
rneovim-1f8afe15a4670b237a4e97d8038ddd75c7d9d227.tar.bz2
rneovim-1f8afe15a4670b237a4e97d8038ddd75c7d9d227.zip
multigrid: add multigrid support to test infrastructure
make Screen explicitly tied to its session
Diffstat (limited to 'test/functional/helpers.lua')
-rw-r--r--test/functional/helpers.lua23
1 files changed, 17 insertions, 6 deletions
diff --git a/test/functional/helpers.lua b/test/functional/helpers.lua
index 272b80466c..851f3e720e 100644
--- a/test/functional/helpers.lua
+++ b/test/functional/helpers.lua
@@ -84,6 +84,10 @@ end
local session, loop_running, last_error
+local function get_session()
+ return session
+end
+
local function set_session(s, keep)
if session and not keep then
session:close()
@@ -164,34 +168,34 @@ local function expect_msg_seq(...)
error(final_error)
end
-local function call_and_stop_on_error(...)
+local function call_and_stop_on_error(lsession, ...)
local status, result = copcall(...) -- luacheck: ignore
if not status then
- session:stop()
+ lsession:stop()
last_error = result
return ''
end
return result
end
-local function run(request_cb, notification_cb, setup_cb, timeout)
+local function run_session(lsession, request_cb, notification_cb, setup_cb, timeout)
local on_request, on_notification, on_setup
if request_cb then
function on_request(method, args)
- return call_and_stop_on_error(request_cb, method, args)
+ return call_and_stop_on_error(lsession, request_cb, method, args)
end
end
if notification_cb then
function on_notification(method, args)
- call_and_stop_on_error(notification_cb, method, args)
+ call_and_stop_on_error(lsession, notification_cb, method, args)
end
end
if setup_cb then
function on_setup()
- call_and_stop_on_error(setup_cb)
+ call_and_stop_on_error(lsession, setup_cb)
end
end
@@ -205,6 +209,10 @@ local function run(request_cb, notification_cb, setup_cb, timeout)
end
end
+local function run(request_cb, notification_cb, setup_cb, timeout)
+ run_session(session, request_cb, notification_cb, setup_cb, timeout)
+end
+
local function stop()
session:stop()
end
@@ -677,6 +685,7 @@ local module = {
buffer = buffer,
bufmeths = bufmeths,
call = nvim_call,
+ create_callindex = create_callindex,
clear = clear,
command = nvim_command,
connect = connect,
@@ -701,6 +710,7 @@ local module = {
filter = filter,
funcs = funcs,
get_pathsep = get_pathsep,
+ get_session = get_session,
insert = insert,
iswin = iswin,
map = map,
@@ -732,6 +742,7 @@ local module = {
retry = retry,
rmdir = rmdir,
run = run,
+ run_session = run_session,
set_session = set_session,
set_shell_powershell = set_shell_powershell,
skip_fragile = skip_fragile,