diff options
Diffstat (limited to 'test/functional/helpers.lua')
-rw-r--r-- | test/functional/helpers.lua | 22 |
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) |