mirror of
https://github.com/neovim/neovim.git
synced 2025-12-15 19:05:40 +00:00
test: spawn_wait() starts a non-RPC Nvim process
Problem: Can't use `n.clear()` to test non-RPC `nvim` invocations. So tests end up creating ad-hoc wrappers around `system()` or `jobstart()`. Solution: - Introduce `n.spawn_wait()` - TODO (followup PR): Rename `n.spawn()` and `n.spawn_wait()`. It's misleading that `n.spawn()` returns a RPC session...
This commit is contained in:
@@ -154,8 +154,9 @@ describe('startup', function()
|
||||
|
||||
it('failure modes', function()
|
||||
-- nvim -l <empty>
|
||||
matches('nvim%.?e?x?e?: Argument missing after: "%-l"', fn.system({ nvim_prog, '-l' }))
|
||||
eq(1, eval('v:shell_error'))
|
||||
local proc = n.spawn_wait('-l')
|
||||
matches('nvim%.?e?x?e?: Argument missing after: "%-l"', proc.stderr)
|
||||
eq(1, proc.status)
|
||||
end)
|
||||
|
||||
it('os.exit() sets Nvim exitcode', function()
|
||||
@@ -182,12 +183,11 @@ describe('startup', function()
|
||||
end)
|
||||
|
||||
it('Lua-error sets Nvim exitcode', function()
|
||||
local proc = n.spawn_wait('-l', 'test/functional/fixtures/startup-fail.lua')
|
||||
matches('E5113: .* my pearls!!', proc.output)
|
||||
eq(1, proc.status)
|
||||
|
||||
eq(0, eval('v:shell_error'))
|
||||
matches(
|
||||
'E5113: .* my pearls!!',
|
||||
fn.system({ nvim_prog, '-l', 'test/functional/fixtures/startup-fail.lua' })
|
||||
)
|
||||
eq(1, eval('v:shell_error'))
|
||||
matches(
|
||||
'E5113: .* %[string "error%("whoa"%)"%]:1: whoa',
|
||||
fn.system({ nvim_prog, '-l', '-' }, 'error("whoa")')
|
||||
|
||||
Reference in New Issue
Block a user