mirror of
https://github.com/neovim/neovim.git
synced 2026-02-18 17:38:32 +00:00
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.
This commit is contained in:
@@ -2,7 +2,7 @@ local t = require('test.testutil')
|
||||
local n = require('test.functional.testnvim')()
|
||||
local Screen = require('test.functional.ui.screen')
|
||||
|
||||
local spawn, set_session, clear = n.spawn, n.set_session, n.clear
|
||||
local set_session, clear = n.set_session, n.clear
|
||||
local feed, command = n.feed, n.command
|
||||
local exec = n.exec
|
||||
local insert = n.insert
|
||||
@@ -26,7 +26,7 @@ describe('screen', function()
|
||||
}
|
||||
|
||||
before_each(function()
|
||||
local screen_nvim = spawn(nvim_argv)
|
||||
local screen_nvim = n.new_session(false, { args = nvim_argv, merge = false })
|
||||
set_session(screen_nvim)
|
||||
screen = Screen.new()
|
||||
end)
|
||||
@@ -766,7 +766,7 @@ describe('Screen default colors', function()
|
||||
'colorscheme vim',
|
||||
'--embed',
|
||||
}
|
||||
local screen_nvim = spawn(nvim_argv)
|
||||
local screen_nvim = n.new_session(false, { args = nvim_argv, merge = false })
|
||||
set_session(screen_nvim)
|
||||
screen = Screen.new(53, 14, { rgb = true, ext_termcolors = termcolors or nil })
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user