mirror of
https://github.com/neovim/neovim.git
synced 2025-10-07 02:16:31 +00:00
test: make error clearer for RPC request after crash
This commit is contained in:
@@ -126,6 +126,7 @@ end
|
|||||||
--- @return any
|
--- @return any
|
||||||
function M.request(method, ...)
|
function M.request(method, ...)
|
||||||
assert(session, 'no Nvim session')
|
assert(session, 'no Nvim session')
|
||||||
|
assert(not session.eof_err, 'sending request after EOF from Nvim')
|
||||||
local status, rv = session:request(method, ...)
|
local status, rv = session:request(method, ...)
|
||||||
if not status then
|
if not status then
|
||||||
if loop_running then
|
if loop_running then
|
||||||
@@ -323,10 +324,10 @@ end
|
|||||||
function M.expect_exit(fn_or_timeout, ...)
|
function M.expect_exit(fn_or_timeout, ...)
|
||||||
local eof_err_msg = 'EOF was received from Nvim. Likely the Nvim process crashed.'
|
local eof_err_msg = 'EOF was received from Nvim. Likely the Nvim process crashed.'
|
||||||
if type(fn_or_timeout) == 'function' then
|
if type(fn_or_timeout) == 'function' then
|
||||||
t.matches(eof_err_msg, t.pcall_err(fn_or_timeout, ...))
|
t.matches(vim.pesc(eof_err_msg), t.pcall_err(fn_or_timeout, ...))
|
||||||
else
|
else
|
||||||
t.matches(
|
t.matches(
|
||||||
eof_err_msg,
|
vim.pesc(eof_err_msg),
|
||||||
t.pcall_err(function(timeout, fn, ...)
|
t.pcall_err(function(timeout, fn, ...)
|
||||||
fn(...)
|
fn(...)
|
||||||
assert(session)
|
assert(session)
|
||||||
@@ -696,7 +697,9 @@ end
|
|||||||
--- @param method string
|
--- @param method string
|
||||||
--- @param ... any
|
--- @param ... any
|
||||||
function M.nvim_async(method, ...)
|
function M.nvim_async(method, ...)
|
||||||
assert(session):notify(method, ...)
|
assert(session, 'no Nvim session')
|
||||||
|
assert(not session.eof_err, 'sending notification after EOF from Nvim')
|
||||||
|
session:notify(method, ...)
|
||||||
end
|
end
|
||||||
|
|
||||||
--- Executes a Vimscript function via RPC.
|
--- Executes a Vimscript function via RPC.
|
||||||
|
Reference in New Issue
Block a user