aboutsummaryrefslogtreecommitdiff
path: root/test/functional/helpers.lua
diff options
context:
space:
mode:
authorJustin M. Keyes <justinkz@gmail.com>2022-06-17 01:23:48 +0200
committerGitHub <noreply@github.com>2022-06-17 01:23:48 +0200
commitc57f6b28d71df1eb6e967381a44a1c038a75698d (patch)
tree02a46f56a250d5f59b767ab3af09cf2b72c60d34 /test/functional/helpers.lua
parent279bc71f3c24928de7d46034168fa105592eb1fa (diff)
parent1f2c2a35ad14cfac002d87073471bd84a52860bf (diff)
downloadrneovim-c57f6b28d71df1eb6e967381a44a1c038a75698d.tar.gz
rneovim-c57f6b28d71df1eb6e967381a44a1c038a75698d.tar.bz2
rneovim-c57f6b28d71df1eb6e967381a44a1c038a75698d.zip
Merge #8519 feat: name, test ids, sockets in stdpath(state)
Diffstat (limited to 'test/functional/helpers.lua')
-rw-r--r--test/functional/helpers.lua22
1 files changed, 14 insertions, 8 deletions
diff --git a/test/functional/helpers.lua b/test/functional/helpers.lua
index ffb5694c15..d31d337b63 100644
--- a/test/functional/helpers.lua
+++ b/test/functional/helpers.lua
@@ -431,18 +431,25 @@ end
function module.new_argv(...)
local args = {unpack(module.nvim_argv)}
table.insert(args, '--headless')
+ if _G._nvim_test_id then
+ -- Set the server name to the test-id for logging. #8519
+ table.insert(args, '--listen')
+ table.insert(args, _G._nvim_test_id)
+ end
local new_args
local io_extra
local env = nil
local opts = select(1, ...)
- if type(opts) == 'table' then
+ if type(opts) ~= 'table' then
+ new_args = {...}
+ else
args = remove_args(args, opts.args_rm)
if opts.env then
- local env_tbl = {}
+ local env_opt = {}
for k, v in pairs(opts.env) do
assert(type(k) == 'string')
assert(type(v) == 'string')
- env_tbl[k] = v
+ env_opt[k] = v
end
for _, k in ipairs({
'HOME',
@@ -458,19 +465,18 @@ function module.new_argv(...)
'TMPDIR',
'VIMRUNTIME',
}) do
- if not env_tbl[k] then
- env_tbl[k] = os.getenv(k)
+ -- Set these from the environment unless the caller defined them.
+ if not env_opt[k] then
+ env_opt[k] = os.getenv(k)
end
end
env = {}
- for k, v in pairs(env_tbl) do
+ for k, v in pairs(env_opt) do
env[#env + 1] = k .. '=' .. v
end
end
new_args = opts.args or {}
io_extra = opts.io_extra
- else
- new_args = {...}
end
for _, arg in ipairs(new_args) do
table.insert(args, arg)