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/lua/ui_event_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/lua/ui_event_spec.lua')
-rw-r--r-- | test/functional/lua/ui_event_spec.lua | 13 |
1 files changed, 4 insertions, 9 deletions
diff --git a/test/functional/lua/ui_event_spec.lua b/test/functional/lua/ui_event_spec.lua index 27640d6066..af6b2ceac3 100644 --- a/test/functional/lua/ui_event_spec.lua +++ b/test/functional/lua/ui_event_spec.lua @@ -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() |