From 2208b64891d57a4ab79143183888149be9ee228d Mon Sep 17 00:00:00 2001 From: ZyX Date: Tue, 4 Jul 2017 15:15:23 +0300 Subject: functests: Ensure different SIDs on successive source() calls --- test/functional/helpers.lua | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) (limited to 'test/functional/helpers.lua') diff --git a/test/functional/helpers.lua b/test/functional/helpers.lua index 4a170d993b..d7858cacd5 100644 --- a/test/functional/helpers.lua +++ b/test/functional/helpers.lua @@ -337,11 +337,23 @@ local function read_file(name) return ret end +local sourced_fnames = {} local function source(code) local fname = tmpname() write_file(fname, code) nvim_command('source '..fname) - os.remove(fname) + -- DO NOT REMOVE FILE HERE. + -- do_source() has a habit of checking whether files are “same” by using inode + -- and device IDs. If you run two source() calls in quick succession there is + -- a good chance that underlying filesystem will reuse the inode, making files + -- appear as “symlinks” to do_source when it checks FileIDs. With current + -- setup linux machines (both QB, travis and mine(ZyX-I) with XFS) do reuse + -- inodes, Mac OS machines (again, both QB and travis) do not. + -- + -- Files appearing as “symlinks” mean that both the first and the second + -- source() calls will use same SID, which may fail some tests which check for + -- exact numbers after `` in e.g. function names. + sourced_fnames[#sourced_fnames + 1] = fname return fname end @@ -673,6 +685,9 @@ local module = { return function(after_each) if after_each then after_each(function() + for _, fname in ipairs(sourced_fnames) do + os.remove(fname) + end check_logs() check_cores('build/bin/nvim') end) -- cgit From 91b9ad7d8294532939db51db1045605abfff49c2 Mon Sep 17 00:00:00 2001 From: ZyX Date: Tue, 4 Jul 2017 15:41:59 +0300 Subject: shada: Make sure that code does not attempt to read too long items Fixes #6957 --- test/functional/helpers.lua | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) (limited to 'test/functional/helpers.lua') diff --git a/test/functional/helpers.lua b/test/functional/helpers.lua index 4a170d993b..6baf77bd3a 100644 --- a/test/functional/helpers.lua +++ b/test/functional/helpers.lua @@ -319,7 +319,14 @@ end -- Dedent the given text and write it to the file name. local function write_file(name, text, dont_dedent) local file = io.open(name, 'w') - if not dont_dedent then + if type(text) == 'table' then + -- Byte blob + local bytes = text + text = '' + for _, char in ipairs(bytes) do + text = ('%s%c'):format(text, char) + end + elseif not dont_dedent then text = dedent(text) end file:write(text) -- cgit From efb0aca0ee3d600f34964799862cebb98bd6b0d2 Mon Sep 17 00:00:00 2001 From: "Justin M. Keyes" Date: Sat, 5 Aug 2017 02:51:55 +0200 Subject: test/helpers: disable powershell logo/banner message --- test/functional/helpers.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'test/functional/helpers.lua') diff --git a/test/functional/helpers.lua b/test/functional/helpers.lua index f4b2a8dfdc..848f1ef477 100644 --- a/test/functional/helpers.lua +++ b/test/functional/helpers.lua @@ -367,7 +367,7 @@ end local function set_shell_powershell() source([[ set shell=powershell shellquote=\" shellpipe=\| shellredir=> - set shellcmdflag=\ -NoProfile\ -ExecutionPolicy\ RemoteSigned\ -Command + set shellcmdflag=\ -NoLogo\ -NoProfile\ -ExecutionPolicy\ RemoteSigned\ -Command let &shellxquote=' ' ]]) end -- cgit From 8540b5e4adcf5175b6f73261736a66fecae81f28 Mon Sep 17 00:00:00 2001 From: Björn Linse Date: Sun, 3 Sep 2017 09:29:01 +0200 Subject: test: add hexdump utilitiy function --- test/functional/helpers.lua | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) (limited to 'test/functional/helpers.lua') diff --git a/test/functional/helpers.lua b/test/functional/helpers.lua index 848f1ef477..2472062d1e 100644 --- a/test/functional/helpers.lua +++ b/test/functional/helpers.lua @@ -618,6 +618,33 @@ local function alter_slashes(obj) end end +local function hexdump(str) + local len = string.len( str ) + local dump = "" + local hex = "" + local asc = "" + + for i = 1, len do + if 1 == i % 8 then + dump = dump .. hex .. asc .. "\n" + hex = string.format( "%04x: ", i - 1 ) + asc = "" + end + + local ord = string.byte( str, i ) + hex = hex .. string.format( "%02x ", ord ) + if ord >= 32 and ord <= 126 then + asc = asc .. string.char( ord ) + else + asc = asc .. "." + end + end + + return dump .. hex + .. string.rep( " ", 8 - len % 8 ) .. asc + +end + local module = { prepend_argv = prepend_argv, clear = clear, @@ -687,6 +714,7 @@ local module = { get_pathsep = get_pathsep, missing_provider = missing_provider, alter_slashes = alter_slashes, + hexdump = hexdump, } return function(after_each) -- cgit From 91b856cccec89d5a29c280441f4a6aa7c8393268 Mon Sep 17 00:00:00 2001 From: Björn Linse Date: Sat, 10 Jun 2017 15:25:23 +0200 Subject: channels: tests --- test/functional/helpers.lua | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) (limited to 'test/functional/helpers.lua') diff --git a/test/functional/helpers.lua b/test/functional/helpers.lua index 2472062d1e..272d2045c9 100644 --- a/test/functional/helpers.lua +++ b/test/functional/helpers.lua @@ -100,6 +100,22 @@ local function next_message() return session:next_message() end +local function expect_twostreams(msgs1, msgs2) + local pos1, pos2 = 1, 1 + while pos1 <= #msgs1 or pos2 <= #msgs2 do + local msg = next_message() + if pos1 <= #msgs1 and pcall(eq, msgs1[pos1], msg) then + pos1 = pos1 + 1 + elseif pos2 <= #msgs2 then + eq(msgs2[pos2], msg) + pos2 = pos2 + 1 + else + -- already failed, but show the right error message + eq(msgs1[pos1], msg) + end + end +end + local function call_and_stop_on_error(...) local status, result = copcall(...) -- luacheck: ignore if not status then @@ -663,6 +679,7 @@ local module = { command = nvim_command, request = request, next_message = next_message, + expect_twostreams = expect_twostreams, run = run, stop = stop, eq = eq, -- cgit From 944e3c06193f6d10baa9ba3021e01626337dd884 Mon Sep 17 00:00:00 2001 From: "Justin M. Keyes" Date: Sun, 26 Nov 2017 23:15:17 +0100 Subject: tui: expose terminal type in 'term' option MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Since "builtin" terminfo definitions were implemented (7cbf52db1bdf), the decisions made by tui.c and terminfo.c are more relevant. Exposing that decision in the 'term' option helps with troubleshooting. Also: remove code that allowed setting t_Co. `:set t_Co=…` has never worked; the highlight_spec test asserting that nvim_set_option('t_Co') _does_ work makes no sense, and should not have worked. --- test/functional/helpers.lua | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'test/functional/helpers.lua') diff --git a/test/functional/helpers.lua b/test/functional/helpers.lua index 272d2045c9..da334d4ac6 100644 --- a/test/functional/helpers.lua +++ b/test/functional/helpers.lua @@ -603,6 +603,15 @@ local function get_pathsep() return funcs.fnamemodify('.', ':p'):sub(-1) end +-- Returns a valid, platform-independent $NVIM_LISTEN_ADDRESS. +-- Useful for communicating with child instances. +local function new_pipename() + -- HACK: Start a server temporarily, get the name, then stop it. + local pipename = nvim_eval('serverstart()') + funcs.serverstop(pipename) + return pipename +end + local function missing_provider(provider) if provider == 'ruby' then local prog = funcs['provider#' .. provider .. '#Detect']() @@ -732,6 +741,7 @@ local module = { missing_provider = missing_provider, alter_slashes = alter_slashes, hexdump = hexdump, + new_pipename = new_pipename, } return function(after_each) -- cgit From 7f386b175c2e0f7b76a6e21e38bbbff2f6083d0c Mon Sep 17 00:00:00 2001 From: "Justin M. Keyes" Date: Mon, 4 Dec 2017 22:18:11 +0100 Subject: test: retry(): fix time calculation libuv caches the results of uv.now() until the next loop tick. If a test does not spin the libuv event loop, retry() enters an infinite cycle. --- test/functional/helpers.lua | 1 + 1 file changed, 1 insertion(+) (limited to 'test/functional/helpers.lua') diff --git a/test/functional/helpers.lua b/test/functional/helpers.lua index da334d4ac6..1709427d59 100644 --- a/test/functional/helpers.lua +++ b/test/functional/helpers.lua @@ -261,6 +261,7 @@ local function retry(max, max_ms, fn) if status then return result end + luv.update_time() -- Update cached value of luv.now() (libuv: uv_now()). if (max and tries >= max) or (luv.now() - start_time > timeout) then if type(result) == "string" then result = "\nretry() attempts: "..tostring(tries).."\n"..result -- cgit From 5f288220f93f61b3461814d7b93618fc4d9ab7df Mon Sep 17 00:00:00 2001 From: "Justin M. Keyes" Date: Mon, 4 Dec 2017 22:28:04 +0100 Subject: test: write_file(): support append-mode --- test/functional/helpers.lua | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'test/functional/helpers.lua') diff --git a/test/functional/helpers.lua b/test/functional/helpers.lua index 1709427d59..f939567693 100644 --- a/test/functional/helpers.lua +++ b/test/functional/helpers.lua @@ -334,8 +334,8 @@ local function feed_command(...) end -- Dedent the given text and write it to the file name. -local function write_file(name, text, dont_dedent) - local file = io.open(name, 'w') +local function write_file(name, text, no_dedent, append) + local file = io.open(name, (append and 'a' or 'w')) if type(text) == 'table' then -- Byte blob local bytes = text @@ -343,7 +343,7 @@ local function write_file(name, text, dont_dedent) for _, char in ipairs(bytes) do text = ('%s%c'):format(text, char) end - elseif not dont_dedent then + elseif not no_dedent then text = dedent(text) end file:write(text) -- cgit From a1adfdc7d59979824addce2f519a527f9a5c0290 Mon Sep 17 00:00:00 2001 From: Jan Edmund Lazo Date: Wed, 29 Nov 2017 01:50:11 -0500 Subject: ci: nodejs client acceptance-test #7706 ci: install nodejs 8 in Appveyor, Travis provider: check node version for debug support Resolve https://github.com/neovim/neovim/pull/7577#issuecomment-350590592 for Unix. provider: test if nodejs in ci supports --inspect-brk nodejs host for neovim requires nodejs 6+ to work properly. nodejs 6.12+ or 7.6+ is required for debug support via `node --inspect-brk`. provider: run cli.js of nodejs host directly npm shims are useless because the user cannot set node to debug mode via --inspect-brk. This is problematic on Windows which use batchfiles and shell scripts to compensate for not supporting shebang. The patch uses `npm root -g` to get the absolute path of the global npm modules. If that fails, then the user did not install neovim npm package globally. Use that absolute path to find `neovim/bin/cli.js`, which is what the npm shim actually runs with node. glob() is for a simple file check in case bin/ is removed because the npm shims are ignored now. --- test/functional/helpers.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'test/functional/helpers.lua') diff --git a/test/functional/helpers.lua b/test/functional/helpers.lua index f939567693..bff8d065f8 100644 --- a/test/functional/helpers.lua +++ b/test/functional/helpers.lua @@ -614,7 +614,7 @@ local function new_pipename() end local function missing_provider(provider) - if provider == 'ruby' then + if provider == 'ruby' or provider == 'node' then local prog = funcs['provider#' .. provider .. '#Detect']() return prog == '' and (provider .. ' not detected') or false elseif provider == 'python' or provider == 'python3' then -- cgit From 8c2cb81d7ecb05f5c399696798690e1861c3b96a Mon Sep 17 00:00:00 2001 From: "Justin M. Keyes" Date: Sun, 7 Jan 2018 16:20:37 +0100 Subject: test: set_shell_powershell(): update flags (#7819) --- test/functional/helpers.lua | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) (limited to 'test/functional/helpers.lua') diff --git a/test/functional/helpers.lua b/test/functional/helpers.lua index bff8d065f8..31a2c3b3ff 100644 --- a/test/functional/helpers.lua +++ b/test/functional/helpers.lua @@ -383,9 +383,8 @@ end local function set_shell_powershell() source([[ - set shell=powershell shellquote=\" shellpipe=\| shellredir=> - set shellcmdflag=\ -NoLogo\ -NoProfile\ -ExecutionPolicy\ RemoteSigned\ -Command - let &shellxquote=' ' + set shell=powershell shellquote=( shellpipe=\| shellredir=> shellxquote= + set shellcmdflag=-NoLogo\ -NoProfile\ -ExecutionPolicy\ RemoteSigned\ -Command ]]) end -- cgit From c095f83116eb8ef87983ca5fea61053755fbc4e5 Mon Sep 17 00:00:00 2001 From: "Justin M. Keyes" Date: Fri, 5 Jan 2018 11:17:21 +0100 Subject: api: change nvim_command_output behavior Implement nvim_command_output with `execute({cmd},"silent")`. Behavior changes: - does not provoke any hit-enter prompt - no longer prepends a newline char - does not capture some noise (like the "[New File]" message, see the change to tabnewentered_spec.lua) Technically ("bug-for-bug") this a breaking change. But the previous behavior of nvim_command_output meant that it probably wasn't used for anything outside of tests. Also remove the undocumented `v:command_output` variable which was a hack introduced only for the purposes of nvim_command_output. closes #7726 --- test/functional/helpers.lua | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) (limited to 'test/functional/helpers.lua') diff --git a/test/functional/helpers.lua b/test/functional/helpers.lua index 31a2c3b3ff..dfc4694272 100644 --- a/test/functional/helpers.lua +++ b/test/functional/helpers.lua @@ -644,7 +644,7 @@ local function alter_slashes(obj) end local function hexdump(str) - local len = string.len( str ) + local len = string.len(str) local dump = "" local hex = "" local asc = "" @@ -652,22 +652,20 @@ local function hexdump(str) for i = 1, len do if 1 == i % 8 then dump = dump .. hex .. asc .. "\n" - hex = string.format( "%04x: ", i - 1 ) + hex = string.format("%04x: ", i - 1) asc = "" end - local ord = string.byte( str, i ) - hex = hex .. string.format( "%02x ", ord ) + local ord = string.byte(str, i) + hex = hex .. string.format("%02x ", ord) if ord >= 32 and ord <= 126 then - asc = asc .. string.char( ord ) + asc = asc .. string.char(ord) else asc = asc .. "." end end - return dump .. hex - .. string.rep( " ", 8 - len % 8 ) .. asc - + return dump .. hex .. string.rep(" ", 8 - len % 8) .. asc end local module = { -- cgit From 499c9a15531b7a0e9736a395e8d401ceab3d24d2 Mon Sep 17 00:00:00 2001 From: George Zhao Date: Wed, 24 Jan 2018 18:01:14 +0800 Subject: test/win: fix some environment assumptions #7912 fix #7909 fix #7910 --- test/functional/helpers.lua | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'test/functional/helpers.lua') diff --git a/test/functional/helpers.lua b/test/functional/helpers.lua index dfc4694272..f0e47481da 100644 --- a/test/functional/helpers.lua +++ b/test/functional/helpers.lua @@ -603,6 +603,11 @@ local function get_pathsep() return funcs.fnamemodify('.', ':p'):sub(-1) end +local function pathroot() + local pathsep = package.config:sub(1,1) + return iswin() and (nvim_dir:sub(1,2)..pathsep) or '/' +end + -- Returns a valid, platform-independent $NVIM_LISTEN_ADDRESS. -- Useful for communicating with child instances. local function new_pipename() @@ -736,6 +741,7 @@ local module = { meth_pcall = meth_pcall, NIL = mpack.NIL, get_pathsep = get_pathsep, + pathroot = pathroot, missing_provider = missing_provider, alter_slashes = alter_slashes, hexdump = hexdump, -- cgit From e72ecdb7ca1face1d16e622824aa7bd3c98f5673 Mon Sep 17 00:00:00 2001 From: "Justin M. Keyes" Date: Fri, 16 Feb 2018 19:42:05 +0100 Subject: test/util: expect_msg_seq() job_spec.lua on AppVeyor (Windows) often fails like this: FAILED ] C:/projects/neovim/test/functional\core\job_spec.lua @ 72: jobs changes to given `cwd` directory C:/projects/neovim/test/functional\core\job_spec.lua:81: Expected objects to be the same. Passed in: (table) { [1] = 'notification' [2] = 'stdout' *[3] = { [1] = 0 *[2] = { [1] = 'C:\projects\neovim\Xtest-tmpdir\nvimmSjq1S\0' } } } Expected: (table) { [1] = 'notification' [2] = 'stdout' *[3] = { [1] = 0 *[2] = { [1] = 'C:\projects\neovim\Xtest-tmpdir\nvimmSjq1S\0' *[2] = '' } } } stack traceback: Message chunking is non-deterministic, so we need to try different variants. --- test/functional/helpers.lua | 163 ++++++++++++++++++++++++++++---------------- 1 file changed, 104 insertions(+), 59 deletions(-) (limited to 'test/functional/helpers.lua') diff --git a/test/functional/helpers.lua b/test/functional/helpers.lua index f0e47481da..3f3cdb56ba 100644 --- a/test/functional/helpers.lua +++ b/test/functional/helpers.lua @@ -14,10 +14,12 @@ local check_cores = global_helpers.check_cores local check_logs = global_helpers.check_logs local neq = global_helpers.neq local eq = global_helpers.eq +local eq_any = global_helpers.eq_any local ok = global_helpers.ok local map = global_helpers.map local filter = global_helpers.filter local dedent = global_helpers.dedent +local table_flatten = global_helpers.table_flatten local start_dir = lfs.currentdir() -- XXX: NVIM_PROG takes precedence, QuickBuild sets it. @@ -96,8 +98,8 @@ local function request(method, ...) return rv end -local function next_message() - return session:next_message() +local function next_message(timeout) + return session:next_message(timeout) end local function expect_twostreams(msgs1, msgs2) @@ -116,6 +118,46 @@ local function expect_twostreams(msgs1, msgs2) end end +-- Expects a sequence of next_message() results. If multiple sequences are +-- passed they are tried until one succeeds, in order of shortest to longest. +local function expect_msg_seq(...) + if select('#', ...) < 1 then + error('need at least 1 argument') + end + local seqs = {...} + table.sort(seqs, function(a, b) -- Sort ascending, by (shallow) length. + return #a < #b + end) + + local actual_seq = {} + local final_error = '' + local function cat_err(err1, err2) + if err1 == nil then + return err2 + end + return string.format('%s\n%s\n%s', err1, string.rep('=', 78), err2) + end + for anum = 1, #seqs do + local expected_seq = seqs[anum] + -- Collect enough messages to compare the next expected sequence. + while #actual_seq < #expected_seq do + local msg = next_message(10000) -- Big timeout for ASAN/valgrind. + if msg == nil then + error(cat_err(final_error, + string.format('got %d messages, expected %d', + #actual_seq, #expected_seq))) + end + table.insert(actual_seq, msg) + end + local status, result = pcall(eq, expected_seq, actual_seq) + if status then + return result + end + final_error = cat_err(final_error, result) + end + error(final_error) +end + local function call_and_stop_on_error(...) local status, result = copcall(...) -- luacheck: ignore if not status then @@ -674,78 +716,81 @@ local function hexdump(str) end local module = { - prepend_argv = prepend_argv, + NIL = mpack.NIL, + alter_slashes = alter_slashes, + buffer = buffer, + bufmeths = bufmeths, + call = nvim_call, clear = clear, + command = nvim_command, connect = connect, - retry = retry, - spawn = spawn, + curbuf = curbuf, + curbuf_contents = curbuf_contents, + curbufmeths = curbufmeths, + curtab = curtab, + curtabmeths = curtabmeths, + curwin = curwin, + curwinmeths = curwinmeths, dedent = dedent, - source = source, - rawfeed = rawfeed, - insert = insert, - iswin = iswin, - feed = feed, - feed_command = feed_command, - eval = nvim_eval, - call = nvim_call, - command = nvim_command, - request = request, - next_message = next_message, - expect_twostreams = expect_twostreams, - run = run, - stop = stop, eq = eq, - neq = neq, + eq_any = eq_any, + eval = nvim_eval, + exc_exec = exc_exec, expect = expect, expect_any = expect_any, - ok = ok, - map = map, + expect_msg_seq = expect_msg_seq, + expect_twostreams = expect_twostreams, + feed = feed, + feed_command = feed_command, filter = filter, + funcs = funcs, + get_pathsep = get_pathsep, + hexdump = hexdump, + insert = insert, + iswin = iswin, + map = map, + merge_args = merge_args, + meth_pcall = meth_pcall, + meths = meths, + missing_provider = missing_provider, + mkdir = lfs.mkdir, + neq = neq, + new_pipename = new_pipename, + next_message = next_message, nvim = nvim, + nvim_argv = nvim_argv, nvim_async = nvim_async, + nvim_dir = nvim_dir, nvim_prog = nvim_prog, - nvim_argv = nvim_argv, nvim_set = nvim_set, - nvim_dir = nvim_dir, - buffer = buffer, - window = window, - tabpage = tabpage, - curbuf = curbuf, - curwin = curwin, - curtab = curtab, - curbuf_contents = curbuf_contents, - wait = wait, - sleep = sleep, - set_session = set_session, - write_file = write_file, - read_file = read_file, + ok = ok, os_name = os_name, - rmdir = rmdir, - mkdir = lfs.mkdir, - exc_exec = exc_exec, - redir_exec = redir_exec, - merge_args = merge_args, - funcs = funcs, - meths = meths, - bufmeths = bufmeths, - winmeths = winmeths, - tabmeths = tabmeths, - uimeths = uimeths, - curbufmeths = curbufmeths, - curwinmeths = curwinmeths, - curtabmeths = curtabmeths, + pathroot = pathroot, pending_win32 = pending_win32, - skip_fragile = skip_fragile, + prepend_argv = prepend_argv, + rawfeed = rawfeed, + read_file = read_file, + redir_exec = redir_exec, + request = request, + retry = retry, + rmdir = rmdir, + run = run, + set_session = set_session, set_shell_powershell = set_shell_powershell, + skip_fragile = skip_fragile, + sleep = sleep, + source = source, + spawn = spawn, + stop = stop, + table_flatten = table_flatten, + tabmeths = tabmeths, + tabpage = tabpage, tmpname = tmpname, - meth_pcall = meth_pcall, - NIL = mpack.NIL, - get_pathsep = get_pathsep, - pathroot = pathroot, - missing_provider = missing_provider, - alter_slashes = alter_slashes, - hexdump = hexdump, - new_pipename = new_pipename, + uimeths = uimeths, + wait = wait, + window = window, + winmeths = winmeths, + write_file = write_file, } return function(after_each) -- cgit From 7973847d025aa7af431f1e92c1ee977ceb0eb7e5 Mon Sep 17 00:00:00 2001 From: "Justin M. Keyes" Date: Sun, 18 Feb 2018 19:22:44 +0100 Subject: test/util: remove eq_any() It was added in the parent commit, but ended up not being used. And I can't think of a case where it will be used: instead we would probably want to generalize expect_msg_seq() if necessary. --- test/functional/helpers.lua | 2 -- 1 file changed, 2 deletions(-) (limited to 'test/functional/helpers.lua') diff --git a/test/functional/helpers.lua b/test/functional/helpers.lua index 3f3cdb56ba..a1da55ab1c 100644 --- a/test/functional/helpers.lua +++ b/test/functional/helpers.lua @@ -14,7 +14,6 @@ local check_cores = global_helpers.check_cores local check_logs = global_helpers.check_logs local neq = global_helpers.neq local eq = global_helpers.eq -local eq_any = global_helpers.eq_any local ok = global_helpers.ok local map = global_helpers.map local filter = global_helpers.filter @@ -733,7 +732,6 @@ local module = { curwinmeths = curwinmeths, dedent = dedent, eq = eq, - eq_any = eq_any, eval = nvim_eval, exc_exec = exc_exec, expect = expect, -- cgit From d80bf3c656cc4b64005cbc149a764a5c238203ad Mon Sep 17 00:00:00 2001 From: Jan Edmund Lazo Date: Sat, 11 Nov 2017 03:14:44 -0500 Subject: test: enable ex_cmds/cd_spec.lua on Windows --- test/functional/helpers.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'test/functional/helpers.lua') diff --git a/test/functional/helpers.lua b/test/functional/helpers.lua index a1da55ab1c..1f53200dd8 100644 --- a/test/functional/helpers.lua +++ b/test/functional/helpers.lua @@ -641,7 +641,7 @@ local function redir_exec(cmd) end local function get_pathsep() - return funcs.fnamemodify('.', ':p'):sub(-1) + return iswin() and '\\' or '/' end local function pathroot() -- cgit From fd4021387e696c7a2da4ad776789cfbb938d5332 Mon Sep 17 00:00:00 2001 From: "Justin M. Keyes" Date: Fri, 9 Mar 2018 00:24:38 +0100 Subject: test: rename next_message() to next_msg() --- test/functional/helpers.lua | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'test/functional/helpers.lua') diff --git a/test/functional/helpers.lua b/test/functional/helpers.lua index 1f53200dd8..72b086c574 100644 --- a/test/functional/helpers.lua +++ b/test/functional/helpers.lua @@ -97,14 +97,14 @@ local function request(method, ...) return rv end -local function next_message(timeout) +local function next_msg(timeout) return session:next_message(timeout) end local function expect_twostreams(msgs1, msgs2) local pos1, pos2 = 1, 1 while pos1 <= #msgs1 or pos2 <= #msgs2 do - local msg = next_message() + local msg = next_msg() if pos1 <= #msgs1 and pcall(eq, msgs1[pos1], msg) then pos1 = pos1 + 1 elseif pos2 <= #msgs2 then @@ -117,7 +117,7 @@ local function expect_twostreams(msgs1, msgs2) end end --- Expects a sequence of next_message() results. If multiple sequences are +-- Expects a sequence of next_msg() results. If multiple sequences are -- passed they are tried until one succeeds, in order of shortest to longest. local function expect_msg_seq(...) if select('#', ...) < 1 then @@ -140,7 +140,7 @@ local function expect_msg_seq(...) local expected_seq = seqs[anum] -- Collect enough messages to compare the next expected sequence. while #actual_seq < #expected_seq do - local msg = next_message(10000) -- Big timeout for ASAN/valgrind. + local msg = next_msg(10000) -- Big timeout for ASAN/valgrind. if msg == nil then error(cat_err(final_error, string.format('got %d messages, expected %d', @@ -754,7 +754,7 @@ local module = { mkdir = lfs.mkdir, neq = neq, new_pipename = new_pipename, - next_message = next_message, + next_msg = next_msg, nvim = nvim, nvim_argv = nvim_argv, nvim_async = nvim_async, -- cgit From 496b0f944fcbfd84db9e2dd625c6b756a3d1e467 Mon Sep 17 00:00:00 2001 From: "Justin M. Keyes" Date: Fri, 9 Mar 2018 00:29:20 +0100 Subject: test: next_msg(): default `timeout` to 10s Infinite timeout results in hangs which waste time. If some test needs longer than 10s to wait for a message, it should specify the timeout explicitly. --- test/functional/helpers.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'test/functional/helpers.lua') diff --git a/test/functional/helpers.lua b/test/functional/helpers.lua index 72b086c574..b8d912114d 100644 --- a/test/functional/helpers.lua +++ b/test/functional/helpers.lua @@ -98,7 +98,7 @@ local function request(method, ...) end local function next_msg(timeout) - return session:next_message(timeout) + return session:next_message(timeout and timeout or 10000) end local function expect_twostreams(msgs1, msgs2) -- cgit