2015-08-30 04:12:47 -07:00
|
|
|
local paths = require('test.config.paths')
|
|
|
|
|
|
|
|
local helpers = require('test.functional.helpers')
|
|
|
|
local spawn, set_session, nvim_prog, merge_args =
|
|
|
|
helpers.spawn, helpers.set_session, helpers.nvim_prog, helpers.merge_args
|
|
|
|
|
|
|
|
local additional_cmd = ''
|
|
|
|
|
2015-08-31 11:45:33 -07:00
|
|
|
local function nvim_argv(shada_file)
|
2015-08-30 04:12:47 -07:00
|
|
|
local rtp_value = ('\'%s/runtime\''):format(
|
|
|
|
paths.test_source_path:gsub('\'', '\'\''))
|
2015-11-17 15:31:22 -07:00
|
|
|
local nvim_args = {nvim_prog, '-u', 'NORC', '-i', shada_file or 'NONE', '-N',
|
2015-08-30 04:12:47 -07:00
|
|
|
'--cmd', 'set shortmess+=I background=light noswapfile',
|
|
|
|
'--cmd', 'let &runtimepath=' .. rtp_value,
|
|
|
|
'--cmd', additional_cmd,
|
|
|
|
'--embed'}
|
|
|
|
if helpers.prepend_argv then
|
2015-11-17 15:31:22 -07:00
|
|
|
return merge_args(helpers.prepend_argv, nvim_args)
|
2015-08-30 04:12:47 -07:00
|
|
|
else
|
2015-11-17 15:31:22 -07:00
|
|
|
return nvim_args
|
2015-08-30 04:12:47 -07:00
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
local session = nil
|
|
|
|
|
2015-08-31 11:45:33 -07:00
|
|
|
local reset = function(...)
|
2015-08-30 04:12:47 -07:00
|
|
|
if session then
|
2016-04-13 05:21:32 -07:00
|
|
|
session:close()
|
2015-08-30 04:12:47 -07:00
|
|
|
end
|
2015-08-31 11:45:33 -07:00
|
|
|
session = spawn(nvim_argv(...))
|
2015-08-30 04:12:47 -07:00
|
|
|
set_session(session)
|
|
|
|
end
|
|
|
|
|
|
|
|
local set_additional_cmd = function(s)
|
|
|
|
additional_cmd = s
|
|
|
|
end
|
|
|
|
|
|
|
|
return {
|
|
|
|
reset=reset,
|
|
|
|
set_additional_cmd=set_additional_cmd,
|
|
|
|
}
|