mirror of
https://github.com/neovim/neovim.git
synced 2025-10-21 17:21:49 +00:00
test: assert_alive()
This commit is contained in:
@@ -302,6 +302,10 @@ end
|
|||||||
local function nvim_feed(input)
|
local function nvim_feed(input)
|
||||||
while #input > 0 do
|
while #input > 0 do
|
||||||
local written = module.request('nvim_input', input)
|
local written = module.request('nvim_input', input)
|
||||||
|
if written == nil then
|
||||||
|
module.assert_alive()
|
||||||
|
error('nvim_input returned nil (Nvim process terminated?)')
|
||||||
|
end
|
||||||
input = input:sub(written + 1)
|
input = input:sub(written + 1)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
@@ -586,6 +590,11 @@ function module.expect_any(contents)
|
|||||||
return ok(nil ~= string.find(module.curbuf_contents(), contents, 1, true))
|
return ok(nil ~= string.find(module.curbuf_contents(), contents, 1, true))
|
||||||
end
|
end
|
||||||
|
|
||||||
|
-- Checks that the Nvim session did not terminate.
|
||||||
|
function module.assert_alive()
|
||||||
|
eq(2, module.eval('1+1'))
|
||||||
|
end
|
||||||
|
|
||||||
local function do_rmdir(path)
|
local function do_rmdir(path)
|
||||||
if lfs.attributes(path, 'mode') ~= 'directory' then
|
if lfs.attributes(path, 'mode') ~= 'directory' then
|
||||||
return -- Don't complain.
|
return -- Don't complain.
|
||||||
|
Reference in New Issue
Block a user