diff options
author | Justin M. Keyes <justinkz@gmail.com> | 2022-06-17 01:23:48 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-06-17 01:23:48 +0200 |
commit | c57f6b28d71df1eb6e967381a44a1c038a75698d (patch) | |
tree | 02a46f56a250d5f59b767ab3af09cf2b72c60d34 /test/functional | |
parent | 279bc71f3c24928de7d46034168fa105592eb1fa (diff) | |
parent | 1f2c2a35ad14cfac002d87073471bd84a52860bf (diff) | |
download | rneovim-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')
-rw-r--r-- | test/functional/api/keymap_spec.lua | 4 | ||||
-rw-r--r-- | test/functional/core/log_spec.lua | 57 | ||||
-rw-r--r-- | test/functional/core/startup_spec.lua | 6 | ||||
-rw-r--r-- | test/functional/helpers.lua | 22 | ||||
-rw-r--r-- | test/functional/plugin/lsp_spec.lua | 140 | ||||
-rw-r--r-- | test/functional/preload.lua | 28 | ||||
-rw-r--r-- | test/functional/terminal/api_spec.lua | 4 | ||||
-rw-r--r-- | test/functional/vimscript/let_spec.lua | 26 | ||||
-rw-r--r-- | test/functional/vimscript/server_spec.lua | 20 |
9 files changed, 202 insertions, 105 deletions
diff --git a/test/functional/api/keymap_spec.lua b/test/functional/api/keymap_spec.lua index 4bee10a006..6bc6651e04 100644 --- a/test/functional/api/keymap_spec.lua +++ b/test/functional/api/keymap_spec.lua @@ -336,7 +336,7 @@ describe('nvim_get_keymap', function() return GlobalCount ]]) local mapargs = meths.get_keymap('n') - assert.Truthy(type(mapargs[1].callback) == 'number', 'callback is not luaref number') + assert(type(mapargs[1].callback) == 'number', 'callback is not luaref number') mapargs[1].callback = nil eq({ lhs='asdf', @@ -815,7 +815,7 @@ describe('nvim_set_keymap, nvim_del_keymap', function() assert.truthy(string.match(funcs.maparg('asdf', 'n'), "^<Lua function %d+>")) local mapargs = funcs.maparg('asdf', 'n', false, true) - assert.Truthy(type(mapargs.callback) == 'number', 'callback is not luaref number') + assert(type(mapargs.callback) == 'number', 'callback is not luaref number') mapargs.callback = nil eq(generate_mapargs('n', 'asdf', nil, {sid=sid_lua}), mapargs) end) diff --git a/test/functional/core/log_spec.lua b/test/functional/core/log_spec.lua new file mode 100644 index 0000000000..3b1ccd9559 --- /dev/null +++ b/test/functional/core/log_spec.lua @@ -0,0 +1,57 @@ +local helpers = require('test.functional.helpers')(after_each) +local assert_log = helpers.assert_log +local clear = helpers.clear +local command = helpers.command +local eq = helpers.eq +local exec_lua = helpers.exec_lua +local expect_exit = helpers.expect_exit +local request = helpers.request +local retry = helpers.retry + +describe('log', function() + local testlog = 'Xtest_logging' + + after_each(function() + expect_exit(command, 'qa!') + os.remove(testlog) + end) + + it('skipped before log_init', function() + -- This test is for _visibility_: adjust as needed, after checking for regression. + -- + -- During startup some components may try to log before logging is setup. + -- That should be uncommon (ideally never)--and if there are MANY such + -- calls, that needs investigation. + clear() + eq(0, request('nvim__stats').log_skip) + clear{env={CDPATH='~doesnotexist'}} + assert(request('nvim__stats').log_skip <= 13) + end) + + it('messages are formatted with name or test id', function() + -- Examples: + -- ERR 2022-05-29T12:30:03.800 T2 log_init:110: test log message + -- ERR 2022-05-29T12:30:03.814 T2/child log_init:110: test log message + + clear({env={ + NVIM_LOG_FILE=testlog, + -- TODO: remove this after nvim_log #7062 is merged. + __NVIM_TEST_LOG='1' + }}) + + local tid = _G._nvim_test_id + retry(nil, 1000, function() + assert_log(tid..'%.%d+%.%d +server_init:%d+: test log message', testlog, 100) + end) + + exec_lua([[ + local j1 = vim.fn.jobstart({ vim.v.progpath, '-es', '-V1', '+foochild', '+qa!' }, vim.empty_dict()) + vim.fn.jobwait({ j1 }, 10000) + ]]) + + -- Child Nvim spawned by jobstart() appends "/c" to parent name. + retry(nil, 1000, function() + assert_log('%.%d+%.%d/c +server_init:%d+: test log message', testlog, 100) + end) + end) +end) diff --git a/test/functional/core/startup_spec.lua b/test/functional/core/startup_spec.lua index 18d48efadc..919b7b3f9a 100644 --- a/test/functional/core/startup_spec.lua +++ b/test/functional/core/startup_spec.lua @@ -580,7 +580,7 @@ describe('user config init', function() it('loads default lua config, but shows an error', function() clear{ args_rm={'-u'}, env=xenv } - feed('<cr>') -- confirm "Conflicting config ..." message + feed('<cr><c-c>') -- Dismiss "Conflicting config …" message. eq(1, eval('g:lua_rc')) matches('^E5422: Conflicting configs', meths.exec('messages', true)) end) @@ -632,13 +632,13 @@ describe('runtime:', function() eq(2, eval('g:lua_plugin')) -- Check if plugin_file_path is listed in :scriptname local scripts = meths.exec(':scriptnames', true) - assert.Truthy(scripts:find(plugin_file_path)) + assert(scripts:find(plugin_file_path)) -- Check if plugin_file_path is listed in startup profile local profile_reader = io.open(profiler_file, 'r') local profile_log = profile_reader:read('*a') profile_reader:close() - assert.Truthy(profile_log :find(plugin_file_path)) + assert(profile_log:find(plugin_file_path)) os.remove(profiler_file) rmdir(plugin_path) 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) diff --git a/test/functional/plugin/lsp_spec.lua b/test/functional/plugin/lsp_spec.lua index 22e2354723..6db969693e 100644 --- a/test/functional/plugin/lsp_spec.lua +++ b/test/functional/plugin/lsp_spec.lua @@ -266,8 +266,8 @@ describe('LSP', function() end; -- If the program timed out, then code will be nil. on_exit = function(code, signal) - eq(0, code, "exit code", fake_lsp_logfile) - eq(0, signal, "exit signal", fake_lsp_logfile) + eq(0, code, "exit code") + eq(0, signal, "exit signal") end; -- Note that NIL must be used here. -- on_handler(err, method, result, client_id) @@ -288,8 +288,8 @@ describe('LSP', function() client.stop() end; on_exit = function(code, signal) - eq(101, code, "exit code", fake_lsp_logfile) -- See fake-lsp-server.lua - eq(0, signal, "exit signal", fake_lsp_logfile) + eq(101, code, "exit code") -- See fake-lsp-server.lua + eq(0, signal, "exit signal") assert_log(pesc([[assert_eq failed: left == "\"shutdown\"", right == "\"test\""]]), fake_lsp_logfile) end; @@ -335,8 +335,8 @@ describe('LSP', function() client.stop() end; on_exit = function(code, signal) - eq(0, code, "exit code", fake_lsp_logfile) - eq(0, signal, "exit signal", fake_lsp_logfile) + eq(0, code, "exit code") + eq(0, signal, "exit signal") end; on_handler = function(...) eq(table.remove(expected_handlers), {...}, "expected handler") @@ -367,8 +367,8 @@ describe('LSP', function() client.notify('finish') end; on_exit = function(code, signal) - eq(0, code, "exit code", fake_lsp_logfile) - eq(0, signal, "exit signal", fake_lsp_logfile) + eq(0, code, "exit code") + eq(0, signal, "exit signal") end; on_handler = function(err, result, ctx) eq(table.remove(expected_handlers), {err, result, ctx}, "expected handler") @@ -436,8 +436,8 @@ describe('LSP', function() client = _client end; on_exit = function(code, signal) - eq(0, code, "exit code", fake_lsp_logfile) - eq(0, signal, "exit signal", fake_lsp_logfile) + eq(0, code, "exit code") + eq(0, signal, "exit signal") end; on_handler = function(err, result, ctx) eq(table.remove(expected_handlers), {err, result, ctx}, "expected handler") @@ -496,8 +496,8 @@ describe('LSP', function() eq(false, client.server_capabilities().codeLensProvider) end; on_exit = function(code, signal) - eq(0, code, "exit code", fake_lsp_logfile) - eq(0, signal, "exit signal", fake_lsp_logfile) + eq(0, code, "exit code") + eq(0, signal, "exit signal") end; on_handler = function(...) eq(table.remove(expected_handlers), {...}, "expected handler") @@ -517,8 +517,8 @@ describe('LSP', function() client = c end; on_exit = function(code, signal) - eq(0, code, "exit code", fake_lsp_logfile) - eq(0, signal, "exit signal", fake_lsp_logfile) + eq(0, code, "exit code") + eq(0, signal, "exit signal") end; on_handler = function(err, result, ctx) eq(table.remove(expected_handlers), {err, result, ctx}, "expected handler") @@ -547,8 +547,8 @@ describe('LSP', function() client = c end; on_exit = function(code, signal) - eq(0, code, "exit code", fake_lsp_logfile) - eq(0, signal, "exit signal", fake_lsp_logfile) + eq(0, code, "exit code") + eq(0, signal, "exit signal") end; on_handler = function(err, result, ctx) eq(table.remove(expected_handlers), {err, result, ctx}, "expected handler") @@ -596,8 +596,8 @@ describe('LSP', function() eq(true, client.supports_method("unknown-method")) end; on_exit = function(code, signal) - eq(0, code, "exit code", fake_lsp_logfile) - eq(0, signal, "exit signal", fake_lsp_logfile) + eq(0, code, "exit code") + eq(0, signal, "exit signal") end; on_handler = function(...) eq(table.remove(expected_handlers), {...}, "expected handler") @@ -626,8 +626,8 @@ describe('LSP', function() ]] end; on_exit = function(code, signal) - eq(0, code, "exit code", fake_lsp_logfile) - eq(0, signal, "exit signal", fake_lsp_logfile) + eq(0, code, "exit code") + eq(0, signal, "exit signal") end; on_handler = function(...) eq(table.remove(expected_handlers), {...}, "expected handler") @@ -651,8 +651,8 @@ describe('LSP', function() exec_lua("vim.lsp.buf.type_definition()") end; on_exit = function(code, signal) - eq(0, code, "exit code", fake_lsp_logfile) - eq(0, signal, "exit signal", fake_lsp_logfile) + eq(0, code, "exit code") + eq(0, signal, "exit signal") end; on_handler = function(...) eq(table.remove(expected_handlers), {...}, "expected handler") @@ -672,8 +672,8 @@ describe('LSP', function() client = _client end; on_exit = function(code, signal) - eq(0, code, "exit code", fake_lsp_logfile) - eq(0, signal, "exit signal", fake_lsp_logfile) + eq(0, code, "exit code") + eq(0, signal, "exit signal") eq(0, #expected_handlers, "did not call expected handler") end; on_handler = function(err, _, ctx) @@ -696,8 +696,8 @@ describe('LSP', function() client = _client end; on_exit = function(code, signal) - eq(0, code, "exit code", fake_lsp_logfile) - eq(0, signal, "exit signal", fake_lsp_logfile) + eq(0, code, "exit code") + eq(0, signal, "exit signal") eq(0, #expected_handlers, "did not call expected handler") end; on_handler = function(err, _, ctx) @@ -726,8 +726,8 @@ describe('LSP', function() client.notify("release") end; on_exit = function(code, signal) - eq(0, code, "exit code", fake_lsp_logfile) - eq(0, signal, "exit signal", fake_lsp_logfile) + eq(0, code, "exit code") + eq(0, signal, "exit signal") eq(0, #expected_handlers, "did not call expected handler") end; on_handler = function(err, _, ctx) @@ -759,8 +759,8 @@ describe('LSP', function() client.notify("release") end; on_exit = function(code, signal) - eq(0, code, "exit code", fake_lsp_logfile) - eq(0, signal, "exit signal", fake_lsp_logfile) + eq(0, code, "exit code") + eq(0, signal, "exit signal") eq(0, #expected_handlers, "did not call expected handler") end; on_handler = function(err, _, ctx) @@ -793,8 +793,8 @@ describe('LSP', function() client.notify("release") end; on_exit = function(code, signal) - eq(0, code, "exit code", fake_lsp_logfile) - eq(0, signal, "exit signal", fake_lsp_logfile) + eq(0, code, "exit code") + eq(0, signal, "exit signal") eq(0, #expected_handlers, "did not call expected handler") end; on_handler = function(err, _, ctx) @@ -828,8 +828,8 @@ describe('LSP', function() client.notify("release") end; on_exit = function(code, signal) - eq(0, code, "exit code", fake_lsp_logfile) - eq(0, signal, "exit signal", fake_lsp_logfile) + eq(0, code, "exit code") + eq(0, signal, "exit signal") eq(0, #expected_handlers, "did not call expected handler") eq(3, eval('g:requests')) end; @@ -874,8 +874,8 @@ describe('LSP', function() client.notify('finish') end; on_exit = function(code, signal) - eq(0, code, "exit code", fake_lsp_logfile) - eq(0, signal, "exit signal", fake_lsp_logfile) + eq(0, code, "exit code") + eq(0, signal, "exit signal") end; on_handler = function(err, result, ctx) eq(table.remove(expected_handlers), {err, result, ctx}, "expected handler") @@ -917,8 +917,8 @@ describe('LSP', function() ]] end; on_exit = function(code, signal) - eq(0, code, "exit code", fake_lsp_logfile) - eq(0, signal, "exit signal", fake_lsp_logfile) + eq(0, code, "exit code") + eq(0, signal, "exit signal") end; on_handler = function(err, result, ctx) if ctx.method == 'start' then @@ -960,8 +960,8 @@ describe('LSP', function() ]] end; on_exit = function(code, signal) - eq(0, code, "exit code", fake_lsp_logfile) - eq(0, signal, "exit signal", fake_lsp_logfile) + eq(0, code, "exit code") + eq(0, signal, "exit signal") end; on_handler = function(err, result, ctx) if ctx.method == 'start' then @@ -1003,8 +1003,8 @@ describe('LSP', function() ]] end; on_exit = function(code, signal) - eq(0, code, "exit code", fake_lsp_logfile) - eq(0, signal, "exit signal", fake_lsp_logfile) + eq(0, code, "exit code") + eq(0, signal, "exit signal") end; on_handler = function(err, result, ctx) if ctx.method == 'start' then @@ -1052,8 +1052,8 @@ describe('LSP', function() ]] end; on_exit = function(code, signal) - eq(0, code, "exit code", fake_lsp_logfile) - eq(0, signal, "exit signal", fake_lsp_logfile) + eq(0, code, "exit code") + eq(0, signal, "exit signal") end; on_handler = function(err, result, ctx) if ctx.method == 'start' then @@ -1103,8 +1103,8 @@ describe('LSP', function() ]] end; on_exit = function(code, signal) - eq(0, code, "exit code", fake_lsp_logfile) - eq(0, signal, "exit signal", fake_lsp_logfile) + eq(0, code, "exit code") + eq(0, signal, "exit signal") end; on_handler = function(err, result, ctx) if ctx.method == 'start' then @@ -1154,8 +1154,8 @@ describe('LSP', function() ]] end; on_exit = function(code, signal) - eq(0, code, "exit code", fake_lsp_logfile) - eq(0, signal, "exit signal", fake_lsp_logfile) + eq(0, code, "exit code") + eq(0, signal, "exit signal") end; on_handler = function(err, result, ctx) if ctx.method == 'start' then @@ -1203,8 +1203,8 @@ describe('LSP', function() ]] end; on_exit = function(code, signal) - eq(0, code, "exit code", fake_lsp_logfile) - eq(0, signal, "exit signal", fake_lsp_logfile) + eq(0, code, "exit code") + eq(0, signal, "exit signal") end; on_handler = function(err, result, ctx) if ctx.method == 'start' then @@ -1247,8 +1247,8 @@ describe('LSP', function() ]] end; on_exit = function(code, signal) - eq(0, code, "exit code", fake_lsp_logfile) - eq(0, signal, "exit signal", fake_lsp_logfile) + eq(0, code, "exit code") + eq(0, signal, "exit signal") end; on_handler = function(err, result, ctx) if ctx.method == 'start' then @@ -1298,8 +1298,8 @@ describe('LSP', function() ]] end; on_exit = function(code, signal) - eq(0, code, "exit code", fake_lsp_logfile) - eq(0, signal, "exit signal", fake_lsp_logfile) + eq(0, code, "exit code") + eq(0, signal, "exit signal") end; on_handler = function(err, result,ctx) if ctx.method == 'start' then @@ -1340,8 +1340,8 @@ describe('LSP', function() client.stop(true) end; on_exit = function(code, signal) - eq(0, code, "exit code", fake_lsp_logfile) - eq(0, signal, "exit signal", fake_lsp_logfile) + eq(0, code, "exit code") + eq(0, signal, "exit signal") end; on_handler = function(err, result, ctx) eq(table.remove(expected_handlers), {err, result, ctx}, "expected handler") @@ -1379,8 +1379,8 @@ describe('LSP', function() ]] end; on_exit = function(code, signal) - eq(0, code, "exit code", fake_lsp_logfile) - eq(0, signal, "exit signal", fake_lsp_logfile) + eq(0, code, "exit code") + eq(0, signal, "exit signal") end; on_handler = function(err, result, ctx) eq(table.remove(expected_handlers), {err, result, ctx}, "expected handler") @@ -1725,8 +1725,8 @@ describe('LSP', function() end; -- If the program timed out, then code will be nil. on_exit = function(code, signal) - eq(0, code, "exit code", fake_lsp_logfile) - eq(0, signal, "exit signal", fake_lsp_logfile) + eq(0, code, "exit code") + eq(0, signal, "exit signal") end; -- Note that NIL must be used here. -- on_handler(err, method, result, client_id) @@ -2728,8 +2728,8 @@ describe('LSP', function() ]=]) end; on_exit = function(code, signal) - eq(0, code, "exit code", fake_lsp_logfile) - eq(0, signal, "exit signal", fake_lsp_logfile) + eq(0, code, "exit code") + eq(0, signal, "exit signal") end; on_handler = function(err, result, ctx) -- Don't compare & assert params, they're not relevant for the testcase @@ -2768,8 +2768,8 @@ describe('LSP', function() on_setup = function() end, on_exit = function(code, signal) - eq(0, code, "exit code", fake_lsp_logfile) - eq(0, signal, "exit signal", fake_lsp_logfile) + eq(0, code, "exit code") + eq(0, signal, "exit signal") end, on_handler = function(err, result, ctx) eq(table.remove(expected_handlers), {err, result, ctx}) @@ -2846,8 +2846,8 @@ describe('LSP', function() on_setup = function() end, on_exit = function(code, signal) - eq(0, code, "exit code", fake_lsp_logfile) - eq(0, signal, "exit signal", fake_lsp_logfile) + eq(0, code, "exit code") + eq(0, signal, "exit signal") end, on_handler = function(err, result, ctx) eq(table.remove(expected_handlers), {err, result, ctx}) @@ -2919,8 +2919,8 @@ describe('LSP', function() on_setup = function() end, on_exit = function(code, signal) - eq(0, code, "exit code", fake_lsp_logfile) - eq(0, signal, "exit signal", fake_lsp_logfile) + eq(0, code, "exit code") + eq(0, signal, "exit signal") end, on_handler = function(err, result, ctx) eq(table.remove(expected_handlers), {err, result, ctx}) @@ -2985,8 +2985,8 @@ describe('LSP', function() ]=]) end, on_exit = function(code, signal) - eq(0, code, "exit code", fake_lsp_logfile) - eq(0, signal, "exit signal", fake_lsp_logfile) + eq(0, code, "exit code") + eq(0, signal, "exit signal") end, on_handler = function(err, result, ctx) eq(table.remove(expected_handlers), {err, result, ctx}) diff --git a/test/functional/preload.lua b/test/functional/preload.lua index 24a3977e6b..74f03eaecf 100644 --- a/test/functional/preload.lua +++ b/test/functional/preload.lua @@ -1,8 +1,9 @@ --- Modules loaded here will not be cleared and reloaded by Busted. +-- Modules loaded here will NOT be cleared and reloaded by Busted. -- Busted started doing this to help provide more isolation. See issue #62 -- for more information about this. local helpers = require('test.functional.helpers')(nil) local iswin = helpers.iswin +local busted = require("busted") if iswin() then local ffi = require('ffi') @@ -12,3 +13,28 @@ if iswin() then ]] ffi.C._set_fmode(0x8000) end + +local testid = (function() + local id = 0 + return (function() + id = id + 1 + return id + end) +end)() + +-- Global before_each. https://github.com/Olivine-Labs/busted/issues/613 +local function before_each(_element, _parent) + local id = ('T%d'):format(testid()) + _G._nvim_test_id = id + return nil, true +end +busted.subscribe({ 'test', 'start' }, + before_each, + { + -- Ensure our --helper is handled before --output (see busted/runner.lua). + priority = 1, + -- Don't generate a test-id for skipped tests. /shrug + predicate = function (element, _, status) + return not ((element.descriptor == 'pending' or status == 'pending')) + end + }) diff --git a/test/functional/terminal/api_spec.lua b/test/functional/terminal/api_spec.lua index e28cc03597..b3a0b8a2c8 100644 --- a/test/functional/terminal/api_spec.lua +++ b/test/functional/terminal/api_spec.lua @@ -6,7 +6,7 @@ if helpers.pending_win32(pending) then return end describe('api', function() local screen - local socket_name = "Xtest_functional_api.sock" + local socket_name = "./Xtest_functional_api.sock" before_each(function() helpers.clear() @@ -29,7 +29,7 @@ describe('api', function() {4:~ }| {4:~ }| {4:~ }| - ]]..socket_name..[[ | + ]]..socket_name..[[ | {3:-- TERMINAL --} | ]]) diff --git a/test/functional/vimscript/let_spec.lua b/test/functional/vimscript/let_spec.lua index 4ff4090a18..6e93655e32 100644 --- a/test/functional/vimscript/let_spec.lua +++ b/test/functional/vimscript/let_spec.lua @@ -47,33 +47,33 @@ describe(':let', function() end) it("multibyte env var #8398 #9267", function() - command("let $NVIM_TEST = 'AìaB'") - eq('AìaB', eval('$NVIM_TEST')) - command("let $NVIM_TEST = 'AaあB'") - eq('AaあB', eval('$NVIM_TEST')) + command("let $NVIM_TEST_LET = 'AìaB'") + eq('AìaB', eval('$NVIM_TEST_LET')) + command("let $NVIM_TEST_LET = 'AaあB'") + eq('AaあB', eval('$NVIM_TEST_LET')) local mbyte = [[\p* .ม .ม .ม .ม่ .ม่ .ม่ ֹ ֹ ֹ .ֹ .ֹ .ֹ ֹֻ ֹֻ ֹֻ .ֹֻ .ֹֻ .ֹֻ ֹֻ ֹֻ ֹֻ .ֹֻ .ֹֻ .ֹֻ ֹ ֹ ֹ .ֹ .ֹ .ֹ ֹ ֹ ֹ .ֹ .ֹ .ֹ ֹֻ ֹֻ .ֹֻ .ֹֻ .ֹֻ a a a ca ca ca à à à]] - command("let $NVIM_TEST = '"..mbyte.."'") - eq(mbyte, eval('$NVIM_TEST')) + command("let $NVIM_TEST_LET = '"..mbyte.."'") + eq(mbyte, eval('$NVIM_TEST_LET')) end) it("multibyte env var to child process #8398 #9267", function() - local cmd_get_child_env = "let g:env_from_child = system(['"..nvim_dir.."/printenv-test', 'NVIM_TEST'])" - command("let $NVIM_TEST = 'AìaB'") + local cmd_get_child_env = "let g:env_from_child = system(['"..nvim_dir.."/printenv-test', 'NVIM_TEST_LET'])" + command("let $NVIM_TEST_LET = 'AìaB'") command(cmd_get_child_env) - eq(eval('$NVIM_TEST'), eval('g:env_from_child')) + eq(eval('$NVIM_TEST_LET'), eval('g:env_from_child')) - command("let $NVIM_TEST = 'AaあB'") + command("let $NVIM_TEST_LET = 'AaあB'") command(cmd_get_child_env) - eq(eval('$NVIM_TEST'), eval('g:env_from_child')) + eq(eval('$NVIM_TEST_LET'), eval('g:env_from_child')) local mbyte = [[\p* .ม .ม .ม .ม่ .ม่ .ม่ ֹ ֹ ֹ .ֹ .ֹ .ֹ ֹֻ ֹֻ ֹֻ .ֹֻ .ֹֻ .ֹֻ ֹֻ ֹֻ ֹֻ .ֹֻ .ֹֻ .ֹֻ ֹ ֹ ֹ .ֹ .ֹ .ֹ ֹ ֹ ֹ .ֹ .ֹ .ֹ ֹֻ ֹֻ .ֹֻ .ֹֻ .ֹֻ a a a ca ca ca à à à]] - command("let $NVIM_TEST = '"..mbyte.."'") + command("let $NVIM_TEST_LET = '"..mbyte.."'") command(cmd_get_child_env) - eq(eval('$NVIM_TEST'), eval('g:env_from_child')) + eq(eval('$NVIM_TEST_LET'), eval('g:env_from_child')) end) it("release of list assigned to l: variable does not trigger assertion #12387, #12430", function() diff --git a/test/functional/vimscript/server_spec.lua b/test/functional/vimscript/server_spec.lua index de64a77b4d..ea07be231d 100644 --- a/test/functional/vimscript/server_spec.lua +++ b/test/functional/vimscript/server_spec.lua @@ -30,7 +30,7 @@ describe('server', function() eq('', eval('$NVIM_LISTEN_ADDRESS')) local servers = funcs.serverlist() eq(1, #servers) - ok(string.len(servers[1]) > 4) -- Like /tmp/nvim…/… or \\.\pipe\… + ok(string.len(servers[1]) > 4) -- "~/.local/state/nvim…/…" or "\\.\pipe\…" end) it('sets v:servername at startup or if all servers were stopped', function() @@ -54,7 +54,7 @@ describe('server', function() -- v:servername and $NVIM take the next available server. local servername = (iswin() and [[\\.\pipe\Xtest-functional-server-pipe]] - or 'Xtest-functional-server-socket') + or './Xtest-functional-server-socket') funcs.serverstart(servername) eq(servername, meths.get_vvar('servername')) -- Not set in the current process, only in children. @@ -66,7 +66,7 @@ describe('server', function() eq(0, eval("serverstop('bogus-socket-name')")) end) - it('parses endpoints correctly', function() + it('parses endpoints', function() clear_serverlist() eq({}, funcs.serverlist()) @@ -101,6 +101,10 @@ describe('server', function() eq(expected, funcs.serverlist()) clear_serverlist() + -- Address without slashes is a "name" which is appended to a generated path. #8519 + matches([[.*[/\\]xtest1%.2%.3%.4[^/\\]*]], funcs.serverstart('xtest1.2.3.4')) + clear_serverlist() + eq('Vim:Failed to start server: invalid argument', pcall_err(funcs.serverstart, '127.0.0.1:65536')) -- invalid port eq({}, funcs.serverlist()) @@ -113,7 +117,7 @@ describe('server', function() -- Add some servers. local servs = (iswin() and { [[\\.\pipe\Xtest-pipe0934]], [[\\.\pipe\Xtest-pipe4324]] } - or { [[Xtest-pipe0934]], [[Xtest-pipe4324]] }) + or { [[./Xtest-pipe0934]], [[./Xtest-pipe4324]] }) for _, s in ipairs(servs) do eq(s, eval("serverstart('"..s.."')")) end @@ -146,9 +150,13 @@ describe('startup --listen', function() it('sets v:servername, overrides $NVIM_LISTEN_ADDRESS', function() local addr = (iswin() and [[\\.\pipe\Xtest-listen-pipe]] - or 'Xtest-listen-pipe') - clear({ env={ NVIM_LISTEN_ADDRESS='Xtest-env-pipe' }, + or './Xtest-listen-pipe') + clear({ env={ NVIM_LISTEN_ADDRESS='./Xtest-env-pipe' }, args={ '--listen', addr } }) eq(addr, meths.get_vvar('servername')) + + -- Address without slashes is a "name" which is appended to a generated path. #8519 + clear({ args={ '--listen', 'test-name' } }) + matches([[.*[/\\]test%-name[^/\\]*]], meths.get_vvar('servername')) end) end) |