diff options
author | Justin M. Keyes <justinkz@gmail.com> | 2024-09-12 03:04:33 +0200 |
---|---|---|
committer | Justin M. Keyes <justinkz@gmail.com> | 2025-01-03 19:24:04 +0100 |
commit | a1ba655dee0f89230ea09712e4df981cc3b15bea (patch) | |
tree | 190940a08a1886cd3eab005ed409f56897f1201f /test/functional/core/startup_spec.lua | |
parent | fe87656f29e933b63f5d4dd03b3c0be3ed4ecf5f (diff) | |
download | rneovim-a1ba655dee0f89230ea09712e4df981cc3b15bea.tar.gz rneovim-a1ba655dee0f89230ea09712e4df981cc3b15bea.tar.bz2 rneovim-a1ba655dee0f89230ea09712e4df981cc3b15bea.zip |
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...
Diffstat (limited to 'test/functional/core/startup_spec.lua')
-rw-r--r-- | test/functional/core/startup_spec.lua | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/test/functional/core/startup_spec.lua b/test/functional/core/startup_spec.lua index 76b0755441..c9ea280646 100644 --- a/test/functional/core/startup_spec.lua +++ b/test/functional/core/startup_spec.lua @@ -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,13 +183,12 @@ 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")') ) |