diff options
author | Justin M. Keyes <justinkz@gmail.com> | 2025-01-04 06:29:13 -0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2025-01-04 06:29:13 -0800 |
commit | 975c2124a6e057e3f50ca5b2ad56572a39c633d9 (patch) | |
tree | e4fe80b5d9625c785a40aa66173808dcc2fe2941 /test/functional/core/exit_spec.lua | |
parent | 7ddadd0feec663fcd9af1f30f055018a872cf2ba (diff) | |
download | rneovim-975c2124a6e057e3f50ca5b2ad56572a39c633d9.tar.gz rneovim-975c2124a6e057e3f50ca5b2ad56572a39c633d9.tar.bz2 rneovim-975c2124a6e057e3f50ca5b2ad56572a39c633d9.zip |
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.
Diffstat (limited to 'test/functional/core/exit_spec.lua')
-rw-r--r-- | test/functional/core/exit_spec.lua | 6 |
1 files changed, 2 insertions, 4 deletions
diff --git a/test/functional/core/exit_spec.lua b/test/functional/core/exit_spec.lua index 34c3eedbd2..65f6bc28a6 100644 --- a/test/functional/core/exit_spec.lua +++ b/test/functional/core/exit_spec.lua @@ -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 |