mirror of
https://github.com/neovim/neovim.git
synced 2025-02-25 18:55:25 -06:00
test: clear(): remove opts.headless
parameter
Callers can instead specify `args_rm={'--headless'}`. TODO: should `nvim_argv` have "--headless" by default? Need to inspect some uses of spawn(nvim_argv) ...
This commit is contained in:
parent
17291642bd
commit
698c4f662d
@ -394,17 +394,16 @@ end
|
|||||||
-- removed, e.g. args_rm={'--cmd'} removes all cases of "--cmd"
|
-- removed, e.g. args_rm={'--cmd'} removes all cases of "--cmd"
|
||||||
-- (and its value) from the default set.
|
-- (and its value) from the default set.
|
||||||
-- env: Map: Defines the environment of the new session.
|
-- env: Map: Defines the environment of the new session.
|
||||||
-- headless: Boolean (default=true): Append --headless arg.
|
|
||||||
--
|
--
|
||||||
-- Example:
|
-- Example:
|
||||||
-- clear('-e')
|
-- clear('-e')
|
||||||
-- clear{args={'-e'}, args_rm={'-i'}, env={TERM=term}}
|
-- clear{args={'-e'}, args_rm={'-i'}, env={TERM=term}}
|
||||||
local function clear(...)
|
local function clear(...)
|
||||||
local args = {unpack(nvim_argv)}
|
local args = {unpack(nvim_argv)}
|
||||||
|
table.insert(args, '--headless')
|
||||||
local new_args
|
local new_args
|
||||||
local env = nil
|
local env = nil
|
||||||
local opts = select(1, ...)
|
local opts = select(1, ...)
|
||||||
local headless = true
|
|
||||||
if type(opts) == 'table' then
|
if type(opts) == 'table' then
|
||||||
args = remove_args(args, opts.args_rm)
|
args = remove_args(args, opts.args_rm)
|
||||||
if opts.env then
|
if opts.env then
|
||||||
@ -432,15 +431,9 @@ local function clear(...)
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
new_args = opts.args or {}
|
new_args = opts.args or {}
|
||||||
if opts.headless == false then
|
|
||||||
headless = false
|
|
||||||
end
|
|
||||||
else
|
else
|
||||||
new_args = {...}
|
new_args = {...}
|
||||||
end
|
end
|
||||||
if headless then
|
|
||||||
table.insert(args, '--headless')
|
|
||||||
end
|
|
||||||
for _, arg in ipairs(new_args) do
|
for _, arg in ipairs(new_args) do
|
||||||
table.insert(args, arg)
|
table.insert(args, arg)
|
||||||
end
|
end
|
||||||
|
@ -8,7 +8,7 @@ local clear = helpers.clear
|
|||||||
local function test_embed(ext_linegrid)
|
local function test_embed(ext_linegrid)
|
||||||
local screen
|
local screen
|
||||||
local function startup(...)
|
local function startup(...)
|
||||||
clear{headless=false, args={...}}
|
clear{args_rm={'--headless'}, args={...}}
|
||||||
|
|
||||||
-- attach immediately after startup, for early UI
|
-- attach immediately after startup, for early UI
|
||||||
screen = Screen.new(60, 8)
|
screen = Screen.new(60, 8)
|
||||||
|
@ -529,7 +529,7 @@ describe('ui/ext_messages', function()
|
|||||||
local screen
|
local screen
|
||||||
|
|
||||||
before_each(function()
|
before_each(function()
|
||||||
clear{headless=false, args={"--cmd", "set shortmess-=I"}}
|
clear{args_rm={'--headless'}, args={"--cmd", "set shortmess-=I"}}
|
||||||
screen = Screen.new(80, 24)
|
screen = Screen.new(80, 24)
|
||||||
screen:attach({rgb=true, ext_messages=true, ext_popupmenu=true})
|
screen:attach({rgb=true, ext_messages=true, ext_popupmenu=true})
|
||||||
screen:set_default_attr_ids({
|
screen:set_default_attr_ids({
|
||||||
|
@ -11,7 +11,7 @@ describe('ext_multigrid', function()
|
|||||||
local screen
|
local screen
|
||||||
|
|
||||||
before_each(function()
|
before_each(function()
|
||||||
clear{headless=false, args={'--cmd', 'set laststatus=2'}}
|
clear{args_rm={'--headless'}, args={'--cmd', 'set laststatus=2'}}
|
||||||
screen = Screen.new(53,14)
|
screen = Screen.new(53,14)
|
||||||
screen:attach({ext_multigrid=true})
|
screen:attach({ext_multigrid=true})
|
||||||
screen:set_default_attr_ids({
|
screen:set_default_attr_ids({
|
||||||
|
@ -115,7 +115,8 @@ describe('ui receives option updates', function()
|
|||||||
end)
|
end)
|
||||||
|
|
||||||
local function startup_test(headless)
|
local function startup_test(headless)
|
||||||
local expected = reset(nil,{headless=headless,args={'--cmd', 'set guifont=Comic\\ Sans\\ 12'}})
|
local expected = reset(nil, {args_rm=(headless and {} or {'--headless'}),
|
||||||
|
args={'--cmd', 'set guifont=Comic\\ Sans\\ 12'}})
|
||||||
expected.guifont = "Comic Sans 12"
|
expected.guifont = "Comic Sans 12"
|
||||||
screen:expect(function()
|
screen:expect(function()
|
||||||
eq(expected, screen.options)
|
eq(expected, screen.options)
|
||||||
|
Loading…
Reference in New Issue
Block a user