diff options
author | Thiago de Arruda <tpadilha84@gmail.com> | 2015-03-17 08:45:13 -0300 |
---|---|---|
committer | Thiago de Arruda <tpadilha84@gmail.com> | 2015-03-24 12:46:15 -0300 |
commit | 47e90ea1c5077bf64dcb729c7fc6ccaaea142c5f (patch) | |
tree | a48b1696f5caa9e51c1bbcfad9e7c887154b46da /test/functional/helpers.lua | |
parent | 5874bc28ea4c649b722eb993d2bd2beea7e3f6d1 (diff) | |
download | rneovim-47e90ea1c5077bf64dcb729c7fc6ccaaea142c5f.tar.gz rneovim-47e90ea1c5077bf64dcb729c7fc6ccaaea142c5f.tar.bz2 rneovim-47e90ea1c5077bf64dcb729c7fc6ccaaea142c5f.zip |
test: Extract code to spawn nvim into the "spawn" helper function
This is can be used for spawning nvim outside a test context. Also refactor
screen.lua to use this function when loading the color map(It is better because
the GDB/VALGRIND environment variables are ignored)
Diffstat (limited to 'test/functional/helpers.lua')
-rw-r--r-- | test/functional/helpers.lua | 17 |
1 files changed, 12 insertions, 5 deletions
diff --git a/test/functional/helpers.lua b/test/functional/helpers.lua index 5627b1fae2..cc5d019863 100644 --- a/test/functional/helpers.lua +++ b/test/functional/helpers.lua @@ -162,15 +162,20 @@ local function rawfeed(...) end end +local function spawn(argv) + local loop = Loop.new() + local msgpack_stream = MsgpackStream.new(loop) + local async_session = AsyncSession.new(msgpack_stream) + local session = Session.new(async_session) + loop:spawn(argv) + return session +end + local function clear() if session then session:exit(0) end - local loop = Loop.new() - local msgpack_stream = MsgpackStream.new(loop) - local async_session = AsyncSession.new(msgpack_stream) - session = Session.new(async_session) - loop:spawn(nvim_argv) + session = spawn(nvim_argv) end local function insert(...) @@ -275,6 +280,7 @@ clear() return { clear = clear, + spawn = spawn, dedent = dedent, source = source, rawfeed = rawfeed, @@ -292,6 +298,7 @@ return { expect = expect, ok = ok, nvim = nvim, + nvim_prog = nvim_prog, nvim_dir = nvim_dir, buffer = buffer, window = window, |