mirror of
https://github.com/neovim/neovim.git
synced 2025-11-22 10:06:33 +00:00
test: use spawn_wait() instead of system() #31852
Problem: Tests that need to check `nvim` CLI behavior (no RPC session) create their own ad-hoc `system()` wrappers. Solution: - Use `n.spawn_wait` instead of `system()`. - Bonus: this also improves the tests by explicitly checking for `stdout` or `stderr`. And if a signal is raised, `ProcStream.status` will reflect it.
This commit is contained in:
@@ -8,8 +8,6 @@ local feed = n.feed
|
||||
local eval = n.eval
|
||||
local eq = t.eq
|
||||
local run = n.run
|
||||
local fn = n.fn
|
||||
local nvim_prog = n.nvim_prog
|
||||
local pcall_err = t.pcall_err
|
||||
local exec_capture = n.exec_capture
|
||||
local poke_eventloop = n.poke_eventloop
|
||||
@@ -69,8 +67,8 @@ describe(':cquit', function()
|
||||
poke_eventloop()
|
||||
assert_alive()
|
||||
else
|
||||
fn.system({ nvim_prog, '-u', 'NONE', '-i', 'NONE', '--headless', '--cmd', cmdline })
|
||||
eq(exit_code, eval('v:shell_error'))
|
||||
local p = n.spawn_wait('--cmd', cmdline)
|
||||
eq(exit_code, p.status)
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
Reference in New Issue
Block a user