diff options
author | Justin M. Keyes <justinkz@gmail.com> | 2025-01-04 16:48:00 -0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2025-01-04 16:48:00 -0800 |
commit | 64b0e6582ae8c273efbe39109bcb261079c2bcd4 (patch) | |
tree | 2e9de1f2224814dc10af8c5ef338e3aaa974f181 /test/functional/terminal | |
parent | a8ace2c58a318552869462a36859aabf1cdfaa68 (diff) | |
download | rneovim-64b0e6582ae8c273efbe39109bcb261079c2bcd4.tar.gz rneovim-64b0e6582ae8c273efbe39109bcb261079c2bcd4.tar.bz2 rneovim-64b0e6582ae8c273efbe39109bcb261079c2bcd4.zip |
refactor(tests): merge n.spawn/n.spawn_argv into n.new_session #31859
Problem:
- `n.spawn()` is misleading because it also connects RPC, it's not just
"spawning" a process.
- It's confusing that `n.spawn()` and `n.spawn_argv()` are separate.
Solution:
- Replace `n.spawn()`/`n.spawn_argv()` with a single function `n.new_session()`.
This name aligns with the existing functions `n.set_session`/`n.get_session`.
- Note: removes direct handling of `prepend_argv`, but I doubt that was
important or intentional. If callers want to control use of `prepend_argv`
then we should add a new flag to `test.session.Opts`.
- Move `keep` to first parameter of `n.new_session()`.
- Add a `merge` flag to `test.session.Opts`
- Mark `_new_argv()` as private. Test should use clear/new_session/spawn_wait
instead.
Diffstat (limited to 'test/functional/terminal')
-rw-r--r-- | test/functional/terminal/tui_spec.lua | 13 |
1 files changed, 6 insertions, 7 deletions
diff --git a/test/functional/terminal/tui_spec.lua b/test/functional/terminal/tui_spec.lua index f9145f9b63..3624a7bc2b 100644 --- a/test/functional/terminal/tui_spec.lua +++ b/test/functional/terminal/tui_spec.lua @@ -26,7 +26,6 @@ local api = n.api local is_ci = t.is_ci local is_os = t.is_os local new_pipename = n.new_pipename -local spawn_argv = n.spawn_argv local set_session = n.set_session local write_file = t.write_file local eval = n.eval @@ -3320,8 +3319,8 @@ describe('TUI as a client', function() end) it('connects to remote instance (with its own TUI)', function() - local server_super = spawn_argv(false) -- equivalent to clear() - local client_super = spawn_argv(true) + local server_super = n.new_session(false) + local client_super = n.new_session(true) set_session(server_super) local server_pipe = new_pipename() @@ -3395,8 +3394,8 @@ describe('TUI as a client', function() end) it('connects to remote instance (--headless)', function() - local server = spawn_argv(false) -- equivalent to clear() - local client_super = spawn_argv(true, { env = { NVIM_LOG_FILE = testlog } }) + local server = n.new_session(false) + local client_super = n.new_session(true, { env = { NVIM_LOG_FILE = testlog } }) set_session(server) local server_pipe = api.nvim_get_vvar('servername') @@ -3462,8 +3461,8 @@ describe('TUI as a client', function() end) local function test_remote_tui_quit(status) - local server_super = spawn_argv(false) -- equivalent to clear() - local client_super = spawn_argv(true) + local server_super = n.new_session(false) + local client_super = n.new_session(true) set_session(server_super) local server_pipe = new_pipename() |