mirror of
https://github.com/neovim/neovim.git
synced 2026-04-21 14:55: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:
@@ -106,20 +106,15 @@ describe('vim.ui_attach', function()
|
||||
end)
|
||||
|
||||
it('does not crash on exit', function()
|
||||
fn.system({
|
||||
n.nvim_prog,
|
||||
'-u',
|
||||
'NONE',
|
||||
'-i',
|
||||
'NONE',
|
||||
local p = n.spawn_wait(
|
||||
'--cmd',
|
||||
[[ lua ns = vim.api.nvim_create_namespace 'testspace' ]],
|
||||
'--cmd',
|
||||
[[ lua vim.ui_attach(ns, {ext_popupmenu=true}, function() end) ]],
|
||||
'--cmd',
|
||||
'quitall!',
|
||||
})
|
||||
eq(0, n.eval('v:shell_error'))
|
||||
'quitall!'
|
||||
)
|
||||
eq(0, p.status)
|
||||
end)
|
||||
|
||||
it('can receive accurate message kinds even if they are history', function()
|
||||
|
||||
Reference in New Issue
Block a user