diff options
Diffstat (limited to 'test/functional/vimscript')
44 files changed, 373 insertions, 305 deletions
diff --git a/test/functional/vimscript/api_functions_spec.lua b/test/functional/vimscript/api_functions_spec.lua index bb10db8cd3..40d96ec281 100644 --- a/test/functional/vimscript/api_functions_spec.lua +++ b/test/functional/vimscript/api_functions_spec.lua @@ -1,13 +1,15 @@ -local t = require('test.functional.testutil')() +local t = require('test.testutil') +local n = require('test.functional.testnvim')() local Screen = require('test.functional.ui.screen') -local neq, eq, command = t.neq, t.eq, t.command -local clear = t.clear -local exc_exec, expect, eval = t.exc_exec, t.expect, t.eval -local exec_lua = t.exec_lua -local insert, pcall_err = t.insert, t.pcall_err + +local neq, eq, command = t.neq, t.eq, n.command +local clear = n.clear +local exc_exec, expect, eval = n.exc_exec, n.expect, n.eval +local exec_lua = n.exec_lua +local insert, pcall_err = n.insert, t.pcall_err local matches = t.matches -local api = t.api -local feed = t.feed +local api = n.api +local feed = n.feed describe('eval-API', function() before_each(clear) diff --git a/test/functional/vimscript/buf_functions_spec.lua b/test/functional/vimscript/buf_functions_spec.lua index 4889db0cb7..625fbe7e03 100644 --- a/test/functional/vimscript/buf_functions_spec.lua +++ b/test/functional/vimscript/buf_functions_spec.lua @@ -1,13 +1,14 @@ -local t = require('test.functional.testutil')() +local t = require('test.testutil') +local n = require('test.functional.testnvim')() local eq = t.eq -local clear = t.clear -local fn = t.fn -local api = t.api -local command = t.command -local exc_exec = t.exc_exec -local get_pathsep = t.get_pathsep -local rmdir = t.rmdir +local clear = n.clear +local fn = n.fn +local api = n.api +local command = n.command +local exc_exec = n.exc_exec +local get_pathsep = n.get_pathsep +local rmdir = n.rmdir local pcall_err = t.pcall_err local mkdir = t.mkdir diff --git a/test/functional/vimscript/changedtick_spec.lua b/test/functional/vimscript/changedtick_spec.lua index ad8d42b4d5..baea53a700 100644 --- a/test/functional/vimscript/changedtick_spec.lua +++ b/test/functional/vimscript/changedtick_spec.lua @@ -1,15 +1,16 @@ -local t = require('test.functional.testutil')() +local t = require('test.testutil') +local n = require('test.functional.testnvim')() local eq = t.eq -local eval = t.eval -local feed = t.feed -local clear = t.clear -local fn = t.fn -local api = t.api -local command = t.command -local exc_exec = t.exc_exec +local eval = n.eval +local feed = n.feed +local clear = n.clear +local fn = n.fn +local api = n.api +local command = n.command +local exc_exec = n.exc_exec local pcall_err = t.pcall_err -local exec_capture = t.exec_capture +local exec_capture = n.exec_capture before_each(clear) diff --git a/test/functional/vimscript/container_functions_spec.lua b/test/functional/vimscript/container_functions_spec.lua index a1bbee1e15..1d95bf6470 100644 --- a/test/functional/vimscript/container_functions_spec.lua +++ b/test/functional/vimscript/container_functions_spec.lua @@ -1,9 +1,10 @@ -local t = require('test.functional.testutil')() +local t = require('test.testutil') +local n = require('test.functional.testnvim')() local eq = t.eq -local eval = t.eval -local api = t.api -local clear = t.clear +local eval = n.eval +local api = n.api +local clear = n.clear before_each(clear) diff --git a/test/functional/vimscript/ctx_functions_spec.lua b/test/functional/vimscript/ctx_functions_spec.lua index 956abe12e6..5e9a803b5d 100644 --- a/test/functional/vimscript/ctx_functions_spec.lua +++ b/test/functional/vimscript/ctx_functions_spec.lua @@ -1,16 +1,17 @@ -local t = require('test.functional.testutil')() +local t = require('test.testutil') +local n = require('test.functional.testnvim')() -local call = t.call -local clear = t.clear -local command = t.command +local call = n.call +local clear = n.clear +local command = n.command local eq = t.eq -local eval = t.eval -local feed = t.feed +local eval = n.eval +local feed = n.feed local map = vim.tbl_map -local api = t.api -local parse_context = t.parse_context -local exec_capture = t.exec_capture -local source = t.source +local api = n.api +local parse_context = n.parse_context +local exec_capture = n.exec_capture +local source = n.source local trim = vim.trim local write_file = t.write_file local pcall_err = t.pcall_err diff --git a/test/functional/vimscript/environ_spec.lua b/test/functional/vimscript/environ_spec.lua index 9ef0edd815..abb093a6c8 100644 --- a/test/functional/vimscript/environ_spec.lua +++ b/test/functional/vimscript/environ_spec.lua @@ -1,13 +1,15 @@ -local t = require('test.functional.testutil')() -local clear = t.clear +local t = require('test.testutil') +local n = require('test.functional.testnvim')() + +local clear = n.clear local eq = t.eq -local environ = t.fn.environ -local exists = t.fn.exists -local system = t.fn.system -local nvim_prog = t.nvim_prog -local command = t.command -local eval = t.eval -local setenv = t.fn.setenv +local environ = n.fn.environ +local exists = n.fn.exists +local system = n.fn.system +local nvim_prog = n.nvim_prog +local command = n.command +local eval = n.eval +local setenv = n.fn.setenv describe('environment variables', function() it('environ() handles empty env variable', function() diff --git a/test/functional/vimscript/errorlist_spec.lua b/test/functional/vimscript/errorlist_spec.lua index 4e473b9e44..ef9111f788 100644 --- a/test/functional/vimscript/errorlist_spec.lua +++ b/test/functional/vimscript/errorlist_spec.lua @@ -1,13 +1,14 @@ -local t = require('test.functional.testutil')() +local t = require('test.testutil') +local n = require('test.functional.testnvim')() -local clear = t.clear -local command = t.command +local clear = n.clear +local command = n.command local eq = t.eq -local exc_exec = t.exc_exec -local get_win_var = t.api.nvim_win_get_var +local exc_exec = n.exc_exec +local get_win_var = n.api.nvim_win_get_var describe('setqflist()', function() - local setqflist = t.fn.setqflist + local setqflist = n.fn.setqflist before_each(clear) @@ -46,7 +47,7 @@ describe('setqflist()', function() end) describe('setloclist()', function() - local setloclist = t.fn.setloclist + local setloclist = n.fn.setloclist before_each(clear) @@ -73,7 +74,7 @@ describe('setloclist()', function() end) it("doesn't crash when when window is closed in the middle #13721", function() - t.insert([[ + n.insert([[ hello world]]) command('vsplit') @@ -82,6 +83,6 @@ describe('setloclist()', function() command('call setloclist(0, [])') command('lopen') - t.assert_alive() + n.assert_alive() end) end) diff --git a/test/functional/vimscript/eval_spec.lua b/test/functional/vimscript/eval_spec.lua index b7c0803ef7..0c812d968e 100644 --- a/test/functional/vimscript/eval_spec.lua +++ b/test/functional/vimscript/eval_spec.lua @@ -9,37 +9,38 @@ -- test/functional/vimscript/<funcname>_spec.lua -- test/functional/vimscript/functions_spec.lua -local t = require('test.functional.testutil')() +local t = require('test.testutil') +local n = require('test.functional.testnvim')() local Screen = require('test.functional.ui.screen') local mkdir = t.mkdir -local clear = t.clear +local clear = n.clear local eq = t.eq -local exec = t.exec -local exc_exec = t.exc_exec -local exec_lua = t.exec_lua -local exec_capture = t.exec_capture -local eval = t.eval -local command = t.command +local exec = n.exec +local exc_exec = n.exc_exec +local exec_lua = n.exec_lua +local exec_capture = n.exec_capture +local eval = n.eval +local command = n.command local write_file = t.write_file -local api = t.api +local api = n.api local sleep = vim.uv.sleep local matches = t.matches local pcall_err = t.pcall_err -local assert_alive = t.assert_alive -local poke_eventloop = t.poke_eventloop -local feed = t.feed -local expect_exit = t.expect_exit +local assert_alive = n.assert_alive +local poke_eventloop = n.poke_eventloop +local feed = n.feed +local expect_exit = n.expect_exit describe('Up to MAX_FUNC_ARGS arguments are handled by', function() local max_func_args = 20 -- from eval.h - local range = t.fn.range + local range = n.fn.range before_each(clear) it('printf()', function() - local printf = t.fn.printf - local rep = t.fn['repeat'] + local printf = n.fn.printf + local rep = n.fn['repeat'] local expected = '2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,' eq(expected, printf(rep('%d,', max_func_args - 1), unpack(range(2, max_func_args)))) local ret = exc_exec('call printf("", 2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21)') @@ -47,7 +48,7 @@ describe('Up to MAX_FUNC_ARGS arguments are handled by', function() end) it('rpcnotify()', function() - local rpcnotify = t.fn.rpcnotify + local rpcnotify = n.fn.rpcnotify local ret = rpcnotify(0, 'foo', unpack(range(3, max_func_args))) eq(1, ret) ret = exc_exec('call rpcnotify(0, "foo", 3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21)') @@ -69,7 +70,7 @@ describe('backtick expansion', function() end) teardown(function() - t.rmdir('test-backticks') + n.rmdir('test-backticks') end) it("with default 'shell'", function() diff --git a/test/functional/vimscript/executable_spec.lua b/test/functional/vimscript/executable_spec.lua index 75d36c26d9..e5530926c4 100644 --- a/test/functional/vimscript/executable_spec.lua +++ b/test/functional/vimscript/executable_spec.lua @@ -1,7 +1,9 @@ -local t = require('test.functional.testutil')() -local eq, clear, call, write_file, command = t.eq, t.clear, t.call, t.write_file, t.command -local exc_exec = t.exc_exec -local eval = t.eval +local t = require('test.testutil') +local n = require('test.functional.testnvim')() + +local eq, clear, call, write_file, command = t.eq, n.clear, n.call, t.write_file, n.command +local exc_exec = n.exc_exec +local eval = n.eval local is_os = t.is_os describe('executable()', function() diff --git a/test/functional/vimscript/execute_spec.lua b/test/functional/vimscript/execute_spec.lua index 32477323a1..8caaea39a7 100644 --- a/test/functional/vimscript/execute_spec.lua +++ b/test/functional/vimscript/execute_spec.lua @@ -1,14 +1,16 @@ -local t = require('test.functional.testutil')() +local t = require('test.testutil') +local n = require('test.functional.testnvim')() +local Screen = require('test.functional.ui.screen') + local eq = t.eq -local eval = t.eval -local clear = t.clear -local source = t.source -local exc_exec = t.exc_exec +local eval = n.eval +local clear = n.clear +local source = n.source +local exc_exec = n.exc_exec local pcall_err = t.pcall_err -local fn = t.fn -local Screen = require('test.functional.ui.screen') -local command = t.command -local feed = t.feed +local fn = n.fn +local command = n.command +local feed = n.feed local is_os = t.is_os describe('execute()', function() diff --git a/test/functional/vimscript/exepath_spec.lua b/test/functional/vimscript/exepath_spec.lua index a1a2afb4ed..97747619ad 100644 --- a/test/functional/vimscript/exepath_spec.lua +++ b/test/functional/vimscript/exepath_spec.lua @@ -1,11 +1,13 @@ -local t = require('test.functional.testutil')() -local eq, clear, call = t.eq, t.clear, t.call -local command = t.command -local exc_exec = t.exc_exec +local t = require('test.testutil') +local n = require('test.functional.testnvim')() + +local eq, clear, call = t.eq, n.clear, n.call +local command = n.command +local exc_exec = n.exc_exec local matches = t.matches local is_os = t.is_os -local set_shell_powershell = t.set_shell_powershell -local eval = t.eval +local set_shell_powershell = n.set_shell_powershell +local eval = n.eval local find_dummies = function(ext_pat) local tmp_path = eval('$PATH') diff --git a/test/functional/vimscript/fnamemodify_spec.lua b/test/functional/vimscript/fnamemodify_spec.lua index fd2c79d9a5..51b1e8489a 100644 --- a/test/functional/vimscript/fnamemodify_spec.lua +++ b/test/functional/vimscript/fnamemodify_spec.lua @@ -1,11 +1,13 @@ -local t = require('test.functional.testutil')() -local clear = t.clear +local t = require('test.testutil') +local n = require('test.functional.testnvim')() + +local clear = n.clear local eq = t.eq -local fnamemodify = t.fn.fnamemodify -local getcwd = t.fn.getcwd -local command = t.command +local fnamemodify = n.fn.fnamemodify +local getcwd = n.fn.getcwd +local command = n.command local write_file = t.write_file -local alter_slashes = t.alter_slashes +local alter_slashes = n.alter_slashes local is_os = t.is_os local function eq_slashconvert(expected, got) @@ -24,7 +26,7 @@ describe('fnamemodify()', function() end) it('handles the root path', function() - local root = t.pathroot() + local root = n.pathroot() eq(root, fnamemodify([[/]], ':p:h')) eq(root, fnamemodify([[/]], ':p')) if is_os('win') then diff --git a/test/functional/vimscript/functions_spec.lua b/test/functional/vimscript/functions_spec.lua index 1d57b60b95..7d9e80a32b 100644 --- a/test/functional/vimscript/functions_spec.lua +++ b/test/functional/vimscript/functions_spec.lua @@ -5,10 +5,11 @@ -- -- Core "eval" tests live in eval_spec.lua. -local t = require('test.functional.testutil')() +local t = require('test.testutil') +local n = require('test.functional.testnvim')() -local clear = t.clear -local eval = t.eval +local clear = n.clear +local eval = n.eval local matches = t.matches local is_os = t.is_os diff --git a/test/functional/vimscript/getline_spec.lua b/test/functional/vimscript/getline_spec.lua index 18f7eabc25..32be6b5702 100644 --- a/test/functional/vimscript/getline_spec.lua +++ b/test/functional/vimscript/getline_spec.lua @@ -1,9 +1,10 @@ -local t = require('test.functional.testutil')() +local t = require('test.testutil') +local n = require('test.functional.testnvim')() -local call = t.call -local clear = t.clear +local call = n.call +local clear = n.clear local eq = t.eq -local expect = t.expect +local expect = n.expect describe('getline()', function() before_each(function() diff --git a/test/functional/vimscript/glob_spec.lua b/test/functional/vimscript/glob_spec.lua index c66865611f..754381231e 100644 --- a/test/functional/vimscript/glob_spec.lua +++ b/test/functional/vimscript/glob_spec.lua @@ -1,5 +1,7 @@ -local t = require('test.functional.testutil')() -local clear, command, eval, eq = t.clear, t.command, t.eval, t.eq +local t = require('test.testutil') +local n = require('test.functional.testnvim')() + +local clear, command, eval, eq = n.clear, n.command, n.eval, t.eq local mkdir = t.mkdir before_each(function() diff --git a/test/functional/vimscript/has_spec.lua b/test/functional/vimscript/has_spec.lua index 05d5b04a29..1d2187be6b 100644 --- a/test/functional/vimscript/has_spec.lua +++ b/test/functional/vimscript/has_spec.lua @@ -1,11 +1,13 @@ -local t = require('test.functional.testutil')() +local t = require('test.testutil') +local n = require('test.functional.testnvim')() local Screen = require('test.functional.ui.screen') -local clear = t.clear -local connect = t.connect + +local clear = n.clear +local connect = n.connect local eq = t.eq -local fn = t.fn +local fn = n.fn local is_os = t.is_os -local nvim_prog = t.nvim_prog +local nvim_prog = n.nvim_prog describe('has()', function() before_each(clear) diff --git a/test/functional/vimscript/hostname_spec.lua b/test/functional/vimscript/hostname_spec.lua index e5be1cf4c3..e6b2499775 100644 --- a/test/functional/vimscript/hostname_spec.lua +++ b/test/functional/vimscript/hostname_spec.lua @@ -1,8 +1,10 @@ -local t = require('test.functional.testutil')() +local t = require('test.testutil') +local n = require('test.functional.testnvim')() + local eq = t.eq local ok = t.ok -local call = t.call -local clear = t.clear +local call = n.call +local clear = n.clear local is_os = t.is_os describe('hostname()', function() diff --git a/test/functional/vimscript/input_spec.lua b/test/functional/vimscript/input_spec.lua index e974d71356..552ae6d5cc 100644 --- a/test/functional/vimscript/input_spec.lua +++ b/test/functional/vimscript/input_spec.lua @@ -1,14 +1,15 @@ -local t = require('test.functional.testutil')() +local t = require('test.testutil') +local n = require('test.functional.testnvim')() local Screen = require('test.functional.ui.screen') local eq = t.eq -local feed = t.feed -local api = t.api -local clear = t.clear -local source = t.source -local command = t.command -local exc_exec = t.exc_exec -local async_meths = t.async_meths +local feed = n.feed +local api = n.api +local clear = n.clear +local source = n.source +local command = n.command +local exc_exec = n.exc_exec +local async_meths = n.async_meths local NIL = vim.NIL local screen diff --git a/test/functional/vimscript/json_functions_spec.lua b/test/functional/vimscript/json_functions_spec.lua index f17cf7017c..ae56e8873d 100644 --- a/test/functional/vimscript/json_functions_spec.lua +++ b/test/functional/vimscript/json_functions_spec.lua @@ -1,14 +1,16 @@ -local t = require('test.functional.testutil')() -local clear = t.clear -local fn = t.fn -local api = t.api +local t = require('test.testutil') +local n = require('test.functional.testnvim')() + +local clear = n.clear +local fn = n.fn +local api = n.api local eq = t.eq -local eval = t.eval -local command = t.command -local exc_exec = t.exc_exec +local eval = n.eval +local command = n.command +local exc_exec = n.exc_exec local pcall_err = t.pcall_err local NIL = vim.NIL -local source = t.source +local source = n.source describe('json_decode() function', function() local restart = function(...) diff --git a/test/functional/vimscript/lang_spec.lua b/test/functional/vimscript/lang_spec.lua index bb6b3ea5a7..923c8c215d 100644 --- a/test/functional/vimscript/lang_spec.lua +++ b/test/functional/vimscript/lang_spec.lua @@ -1,6 +1,8 @@ -local t = require('test.functional.testutil')() -local clear, eval, eq = t.clear, t.eval, t.eq -local exc_exec, source = t.exc_exec, t.source +local t = require('test.testutil') +local n = require('test.functional.testnvim')() + +local clear, eval, eq = n.clear, n.eval, t.eq +local exc_exec, source = n.exc_exec, n.source describe('vimscript', function() before_each(clear) diff --git a/test/functional/vimscript/let_spec.lua b/test/functional/vimscript/let_spec.lua index f8b9ba89d0..412e06df20 100644 --- a/test/functional/vimscript/let_spec.lua +++ b/test/functional/vimscript/let_spec.lua @@ -1,15 +1,16 @@ -local t = require('test.functional.testutil')() +local t = require('test.testutil') +local n = require('test.functional.testnvim')() local eq = t.eq -local clear = t.clear -local command = t.command -local eval = t.eval -local api = t.api -local exec = t.exec -local exec_capture = t.exec_capture -local expect_exit = t.expect_exit -local source = t.source -local testprg = t.testprg +local clear = n.clear +local command = n.command +local eval = n.eval +local api = n.api +local exec = n.exec +local exec_capture = n.exec_capture +local expect_exit = n.expect_exit +local source = n.source +local testprg = n.testprg before_each(clear) diff --git a/test/functional/vimscript/map_functions_spec.lua b/test/functional/vimscript/map_functions_spec.lua index 249b79aa4e..44be5b3185 100644 --- a/test/functional/vimscript/map_functions_spec.lua +++ b/test/functional/vimscript/map_functions_spec.lua @@ -1,17 +1,18 @@ -local t = require('test.functional.testutil')() +local t = require('test.testutil') +local n = require('test.functional.testnvim')() -local clear = t.clear +local clear = n.clear local eq = t.eq -local eval = t.eval -local exec = t.exec -local exec_lua = t.exec_lua -local expect = t.expect -local feed = t.feed -local fn = t.fn -local api = t.api -local source = t.source -local command = t.command -local exec_capture = t.exec_capture +local eval = n.eval +local exec = n.exec +local exec_lua = n.exec_lua +local expect = n.expect +local feed = n.feed +local fn = n.fn +local api = n.api +local source = n.source +local command = n.command +local exec_capture = n.exec_capture local pcall_err = t.pcall_err describe('maparg()', function() diff --git a/test/functional/vimscript/match_functions_spec.lua b/test/functional/vimscript/match_functions_spec.lua index 98a2169676..87c57f1c15 100644 --- a/test/functional/vimscript/match_functions_spec.lua +++ b/test/functional/vimscript/match_functions_spec.lua @@ -1,11 +1,12 @@ -local t = require('test.functional.testutil')() +local t = require('test.testutil') +local n = require('test.functional.testnvim')() local Screen = require('test.functional.ui.screen') local eq = t.eq -local clear = t.clear -local fn = t.fn -local command = t.command -local exc_exec = t.exc_exec +local clear = n.clear +local fn = n.fn +local command = n.command +local exc_exec = n.exc_exec before_each(clear) diff --git a/test/functional/vimscript/minmax_functions_spec.lua b/test/functional/vimscript/minmax_functions_spec.lua index 1748c97849..bf223c436e 100644 --- a/test/functional/vimscript/minmax_functions_spec.lua +++ b/test/functional/vimscript/minmax_functions_spec.lua @@ -1,10 +1,11 @@ -local t = require('test.functional.testutil')() +local t = require('test.testutil') +local n = require('test.functional.testnvim')() local eq = t.eq -local eval = t.eval -local command = t.command -local clear = t.clear -local fn = t.fn +local eval = n.eval +local command = n.command +local clear = n.clear +local fn = n.fn local pcall_err = t.pcall_err before_each(clear) diff --git a/test/functional/vimscript/modeline_spec.lua b/test/functional/vimscript/modeline_spec.lua index 7dfaba217b..53a5e9b692 100644 --- a/test/functional/vimscript/modeline_spec.lua +++ b/test/functional/vimscript/modeline_spec.lua @@ -1,6 +1,8 @@ -local t = require('test.functional.testutil')() -local assert_alive = t.assert_alive -local clear, command, write_file = t.clear, t.command, t.write_file +local t = require('test.testutil') +local n = require('test.functional.testnvim')() + +local assert_alive = n.assert_alive +local clear, command, write_file = n.clear, n.command, t.write_file describe('modeline', function() local tempfile = t.tmpname() diff --git a/test/functional/vimscript/msgpack_functions_spec.lua b/test/functional/vimscript/msgpack_functions_spec.lua index c945efab5a..d59dceef31 100644 --- a/test/functional/vimscript/msgpack_functions_spec.lua +++ b/test/functional/vimscript/msgpack_functions_spec.lua @@ -1,10 +1,12 @@ -local t = require('test.functional.testutil')() -local clear = t.clear -local fn = t.fn -local eval, eq = t.eval, t.eq -local command = t.command -local api = t.api -local exc_exec = t.exc_exec +local t = require('test.testutil') +local n = require('test.functional.testnvim')() + +local clear = n.clear +local fn = n.fn +local eval, eq = n.eval, t.eq +local command = n.command +local api = n.api +local exc_exec = n.exc_exec local is_os = t.is_os describe('msgpack*() functions', function() @@ -469,12 +471,12 @@ describe('msgpackparse() function', function() end) it('msgpackparse(systemlist(...)) does not segfault. #3135', function() - local cmd = "sort(keys(msgpackparse(systemlist('" .. t.nvim_prog .. " --api-info'))[0]))" + local cmd = "sort(keys(msgpackparse(systemlist('" .. n.nvim_prog .. " --api-info'))[0]))" eval(cmd) eval(cmd) -- do it again (try to force segfault) local api_info = eval(cmd) -- do it again if is_os('win') then - t.assert_alive() + n.assert_alive() pending('msgpackparse() has a bug on windows') return end diff --git a/test/functional/vimscript/null_spec.lua b/test/functional/vimscript/null_spec.lua index fc051371ba..9a27239a6d 100644 --- a/test/functional/vimscript/null_spec.lua +++ b/test/functional/vimscript/null_spec.lua @@ -1,10 +1,11 @@ -local t = require('test.functional.testutil')() +local t = require('test.testutil') +local n = require('test.functional.testnvim')() -local exc_exec = t.exc_exec -local command = t.command -local clear = t.clear -local api = t.api -local fn = t.fn +local exc_exec = n.exc_exec +local command = n.command +local clear = n.clear +local api = n.api +local fn = n.fn local eq = t.eq local function redir_exec(cmd) diff --git a/test/functional/vimscript/operators_spec.lua b/test/functional/vimscript/operators_spec.lua index b6294f1f5a..9c4a91d655 100644 --- a/test/functional/vimscript/operators_spec.lua +++ b/test/functional/vimscript/operators_spec.lua @@ -1,7 +1,9 @@ -local t = require('test.functional.testutil')() +local t = require('test.testutil') +local n = require('test.functional.testnvim')() + local eq = t.eq -local eval = t.eval -local clear = t.clear +local eval = n.eval +local clear = n.clear describe('Division operator', function() before_each(clear) diff --git a/test/functional/vimscript/printf_spec.lua b/test/functional/vimscript/printf_spec.lua index 027edd3b3a..3c66e07618 100644 --- a/test/functional/vimscript/printf_spec.lua +++ b/test/functional/vimscript/printf_spec.lua @@ -1,11 +1,12 @@ -local t = require('test.functional.testutil')() +local t = require('test.testutil') +local n = require('test.functional.testnvim')() -local clear = t.clear +local clear = n.clear local eq = t.eq -local eval = t.eval -local fn = t.fn -local api = t.api -local exc_exec = t.exc_exec +local eval = n.eval +local fn = n.fn +local api = n.api +local exc_exec = n.exc_exec describe('printf()', function() before_each(clear) diff --git a/test/functional/vimscript/reltime_spec.lua b/test/functional/vimscript/reltime_spec.lua index 4d77c911e4..fa110d602a 100644 --- a/test/functional/vimscript/reltime_spec.lua +++ b/test/functional/vimscript/reltime_spec.lua @@ -1,6 +1,8 @@ -local t = require('test.functional.testutil')() -local clear, eq, ok = t.clear, t.eq, t.ok -local neq, command, fn = t.neq, t.command, t.fn +local t = require('test.testutil') +local n = require('test.functional.testnvim')() + +local clear, eq, ok = n.clear, t.eq, t.ok +local neq, command, fn = t.neq, n.command, n.fn local matches = t.matches local reltime, reltimestr, reltimefloat = fn.reltime, fn.reltimestr, fn.reltimefloat diff --git a/test/functional/vimscript/screenchar_spec.lua b/test/functional/vimscript/screenchar_spec.lua index 442d7904a0..b6137d7741 100644 --- a/test/functional/vimscript/screenchar_spec.lua +++ b/test/functional/vimscript/screenchar_spec.lua @@ -1,6 +1,8 @@ -local t = require('test.functional.testutil')() -local clear, eq, neq = t.clear, t.eq, t.neq -local command, api, fn = t.command, t.api, t.fn +local t = require('test.testutil') +local n = require('test.functional.testnvim')() + +local clear, eq, neq = n.clear, t.eq, t.neq +local command, api, fn = n.command, n.api, n.fn local tbl_deep_extend = vim.tbl_deep_extend -- Set up two overlapping floating windows diff --git a/test/functional/vimscript/screenpos_spec.lua b/test/functional/vimscript/screenpos_spec.lua index 057e740205..630e19b841 100644 --- a/test/functional/vimscript/screenpos_spec.lua +++ b/test/functional/vimscript/screenpos_spec.lua @@ -1,7 +1,9 @@ -local t = require('test.functional.testutil')() -local clear, eq, api = t.clear, t.eq, t.api -local command, fn = t.command, t.fn -local feed = t.feed +local t = require('test.testutil') +local n = require('test.functional.testnvim')() + +local clear, eq, api = n.clear, t.eq, n.api +local command, fn = n.command, n.fn +local feed = n.feed before_each(clear) diff --git a/test/functional/vimscript/server_spec.lua b/test/functional/vimscript/server_spec.lua index a079429730..4b0dc087f6 100644 --- a/test/functional/vimscript/server_spec.lua +++ b/test/functional/vimscript/server_spec.lua @@ -1,13 +1,15 @@ -local t = require('test.functional.testutil')() +local t = require('test.testutil') +local n = require('test.functional.testnvim')() + local assert_log = t.assert_log -local eq, neq, eval = t.eq, t.neq, t.eval -local clear, fn, api = t.clear, t.fn, t.api +local eq, neq, eval = t.eq, t.neq, n.eval +local clear, fn, api = n.clear, n.fn, n.api local ok = t.ok local matches = t.matches local pcall_err = t.pcall_err -local check_close = t.check_close +local check_close = n.check_close local mkdir = t.mkdir -local rmdir = t.rmdir +local rmdir = n.rmdir local is_os = t.is_os local testlog = 'Xtest-server-log' @@ -148,7 +150,7 @@ describe('server', function() it('serverlist() returns the list of servers', function() clear() -- There should already be at least one server. - local n = eval('len(serverlist())') + local _n = eval('len(serverlist())') -- Add some servers. local servs = ( @@ -162,25 +164,25 @@ describe('server', function() local new_servs = eval('serverlist()') -- Exactly #servs servers should be added. - eq(n + #servs, #new_servs) + eq(_n + #servs, #new_servs) -- The new servers should be at the end of the list. for i = 1, #servs do - eq(servs[i], new_servs[i + n]) + eq(servs[i], new_servs[i + _n]) eq(1, eval("serverstop('" .. servs[i] .. "')")) end -- After serverstop() the servers should NOT be in the list. - eq(n, eval('len(serverlist())')) + eq(_n, eval('len(serverlist())')) end) end) describe('startup --listen', function() it('validates', function() clear() - local cmd = { unpack(t.nvim_argv) } + local cmd = { unpack(n.nvim_argv) } table.insert(cmd, '--listen') matches('nvim.*: Argument missing after: "%-%-listen"', fn.system(cmd)) - cmd = { unpack(t.nvim_argv) } + cmd = { unpack(n.nvim_argv) } table.insert(cmd, '--listen2') matches('nvim.*: Garbage after option argument: "%-%-listen2"', fn.system(cmd)) end) diff --git a/test/functional/vimscript/setpos_spec.lua b/test/functional/vimscript/setpos_spec.lua index 16a974c511..968da4d8f4 100644 --- a/test/functional/vimscript/setpos_spec.lua +++ b/test/functional/vimscript/setpos_spec.lua @@ -1,12 +1,14 @@ -local t = require('test.functional.testutil')() -local setpos = t.fn.setpos -local getpos = t.fn.getpos -local insert = t.insert -local clear = t.clear -local command = t.command -local eval = t.eval +local t = require('test.testutil') +local n = require('test.functional.testnvim')() + +local setpos = n.fn.setpos +local getpos = n.fn.getpos +local insert = n.insert +local clear = n.clear +local command = n.command +local eval = n.eval local eq = t.eq -local exc_exec = t.exc_exec +local exc_exec = n.exc_exec describe('setpos() function', function() before_each(function() diff --git a/test/functional/vimscript/sort_spec.lua b/test/functional/vimscript/sort_spec.lua index 539b74984c..c8c1651ed8 100644 --- a/test/functional/vimscript/sort_spec.lua +++ b/test/functional/vimscript/sort_spec.lua @@ -1,13 +1,14 @@ -local t = require('test.functional.testutil')() +local t = require('test.testutil') +local n = require('test.functional.testnvim')() local eq = t.eq local NIL = vim.NIL -local eval = t.eval -local clear = t.clear -local api = t.api -local fn = t.fn -local command = t.command -local exc_exec = t.exc_exec +local eval = n.eval +local clear = n.clear +local api = n.api +local fn = n.fn +local command = n.command +local exc_exec = n.exc_exec local pcall_err = t.pcall_err before_each(clear) diff --git a/test/functional/vimscript/special_vars_spec.lua b/test/functional/vimscript/special_vars_spec.lua index 0ce8703735..70e195ba0b 100644 --- a/test/functional/vimscript/special_vars_spec.lua +++ b/test/functional/vimscript/special_vars_spec.lua @@ -1,11 +1,13 @@ -local t = require('test.functional.testutil')() -local exc_exec = t.exc_exec -local command = t.command -local fn = t.fn -local clear = t.clear -local eval = t.eval +local t = require('test.testutil') +local n = require('test.functional.testnvim')() + +local exc_exec = n.exc_exec +local command = n.command +local fn = n.fn +local clear = n.clear +local eval = n.eval local eq = t.eq -local api = t.api +local api = n.api local NIL = vim.NIL describe('Special values', function() diff --git a/test/functional/vimscript/state_spec.lua b/test/functional/vimscript/state_spec.lua index 4a340f9717..211d79928a 100644 --- a/test/functional/vimscript/state_spec.lua +++ b/test/functional/vimscript/state_spec.lua @@ -1,11 +1,13 @@ -local t = require('test.functional.testutil')() -local clear = t.clear +local t = require('test.testutil') +local n = require('test.functional.testnvim')() + +local clear = n.clear local eq = t.eq -local exec = t.exec -local exec_lua = t.exec_lua -local feed = t.feed -local api = t.api -local poke_eventloop = t.poke_eventloop +local exec = n.exec +local exec_lua = n.exec_lua +local feed = n.feed +local api = n.api +local poke_eventloop = n.poke_eventloop before_each(clear) diff --git a/test/functional/vimscript/string_spec.lua b/test/functional/vimscript/string_spec.lua index c57e4e978b..32aa04c0d0 100644 --- a/test/functional/vimscript/string_spec.lua +++ b/test/functional/vimscript/string_spec.lua @@ -1,14 +1,16 @@ -local t = require('test.functional.testutil')() -local clear = t.clear +local t = require('test.testutil') +local n = require('test.functional.testnvim')() + +local clear = n.clear local eq = t.eq -local command = t.command -local api = t.api -local eval = t.eval -local exc_exec = t.exc_exec +local command = n.command +local api = n.api +local eval = n.eval +local exc_exec = n.exc_exec local pcall_err = t.pcall_err -local fn = t.fn +local fn = n.fn local NIL = vim.NIL -local source = t.source +local source = n.source describe('string() function', function() before_each(clear) diff --git a/test/functional/vimscript/system_spec.lua b/test/functional/vimscript/system_spec.lua index 77ba4e8f97..792e4c46c3 100644 --- a/test/functional/vimscript/system_spec.lua +++ b/test/functional/vimscript/system_spec.lua @@ -1,21 +1,21 @@ -- Tests for system() and :! shell. -local t = require('test.functional.testutil')() +local t = require('test.testutil') +local n = require('test.functional.testnvim')() +local Screen = require('test.functional.ui.screen') -local assert_alive = t.assert_alive -local testprg = t.testprg +local assert_alive = n.assert_alive +local testprg = n.testprg local eq, call, clear, eval, feed_command, feed, api = - t.eq, t.call, t.clear, t.eval, t.feed_command, t.feed, t.api -local command = t.command -local insert = t.insert -local expect = t.expect -local exc_exec = t.exc_exec -local os_kill = t.os_kill + t.eq, n.call, n.clear, n.eval, n.feed_command, n.feed, n.api +local command = n.command +local insert = n.insert +local expect = n.expect +local exc_exec = n.exc_exec +local os_kill = n.os_kill local pcall_err = t.pcall_err local is_os = t.is_os -local Screen = require('test.functional.ui.screen') - local function create_file_with_nuls(name) return function() feed('ipart1<C-V>000part2<C-V>000part3<ESC>:w ' .. name .. '<CR>') @@ -183,7 +183,7 @@ describe('system()', function() end) it('with powershell', function() - t.set_shell_powershell() + n.set_shell_powershell() eq('a\nb\n', eval([[system('Write-Output a b')]])) eq('C:\\\n', eval([[system('cd c:\; (Get-Location).Path')]])) eq('a b\n', eval([[system('Write-Output "a b"')]])) @@ -191,11 +191,11 @@ describe('system()', function() end it('powershell w/ UTF-8 text #13713', function() - if not t.has_powershell() then + if not n.has_powershell() then pending('powershell not found', function() end) return end - t.set_shell_powershell() + n.set_shell_powershell() eq('ああ\n', eval([[system('Write-Output "ああ"')]])) -- Sanity test w/ default encoding -- * on Windows, expected to default to Western European enc @@ -241,8 +241,8 @@ describe('system()', function() feed(':edit ' .. tempfile .. '<cr>') - local command_total_time = tonumber(t.fn.split(t.fn.getline(7))[2]) - local command_self_time = tonumber(t.fn.split(t.fn.getline(7))[3]) + local command_total_time = tonumber(n.fn.split(n.fn.getline(7))[2]) + local command_self_time = tonumber(n.fn.split(n.fn.getline(7))[3]) t.neq(nil, command_total_time) t.neq(nil, command_self_time) @@ -548,11 +548,11 @@ describe('systemlist()', function() end) it('powershell w/ UTF-8 text #13713', function() - if not t.has_powershell() then + if not n.has_powershell() then pending('powershell not found', function() end) return end - t.set_shell_powershell() + n.set_shell_powershell() eq({ is_os('win') and 'あ\r' or 'あ' }, eval([[systemlist('Write-Output あ')]])) -- Sanity test w/ default encoding -- * on Windows, expected to default to Western European enc @@ -568,7 +568,7 @@ describe('shell :!', function() it(':{range}! with powershell filter/redirect #16271 #19250', function() local screen = Screen.new(500, 8) screen:attach() - local found = t.set_shell_powershell(true) + local found = n.set_shell_powershell(true) insert([[ 3 1 @@ -615,12 +615,12 @@ describe('shell :!', function() } end feed('<CR>') - t.set_shell_powershell(true) + n.set_shell_powershell(true) feed(':4verbose %w !sort<cr>') screen:expect { any = [[Executing command: .?& { Get%-Content .* | & sort }]], } feed('<CR>') - t.expect_exit(command, 'qall!') + n.expect_exit(command, 'qall!') end) end) diff --git a/test/functional/vimscript/timer_spec.lua b/test/functional/vimscript/timer_spec.lua index 6cd8590500..f075e382bc 100644 --- a/test/functional/vimscript/timer_spec.lua +++ b/test/functional/vimscript/timer_spec.lua @@ -1,11 +1,13 @@ -local t = require('test.functional.testutil')() +local t = require('test.testutil') +local n = require('test.functional.testnvim')() local Screen = require('test.functional.ui.screen') -local feed, eq, eval, ok = t.feed, t.eq, t.eval, t.ok -local source, async_meths, run = t.source, t.async_meths, t.run -local clear, command, fn = t.clear, t.command, t.fn -local exc_exec = t.exc_exec -local api = t.api -local load_adjust = t.load_adjust + +local feed, eq, eval, ok = n.feed, t.eq, n.eval, t.ok +local source, async_meths, run = n.source, n.async_meths, n.run +local clear, command, fn = n.clear, n.command, n.fn +local exc_exec = n.exc_exec +local api = n.api +local load_adjust = n.load_adjust local retry = t.retry describe('timers', function() diff --git a/test/functional/vimscript/uniq_spec.lua b/test/functional/vimscript/uniq_spec.lua index 6ef6dd9960..4e1ef699a4 100644 --- a/test/functional/vimscript/uniq_spec.lua +++ b/test/functional/vimscript/uniq_spec.lua @@ -1,9 +1,10 @@ -local t = require('test.functional.testutil')() +local t = require('test.testutil') +local n = require('test.functional.testnvim')() local eq = t.eq -local clear = t.clear -local command = t.command -local exc_exec = t.exc_exec +local clear = n.clear +local command = n.command +local exc_exec = n.exc_exec local pcall_err = t.pcall_err before_each(clear) diff --git a/test/functional/vimscript/vvar_event_spec.lua b/test/functional/vimscript/vvar_event_spec.lua index e8b8ff36c0..16fa2c9f9f 100644 --- a/test/functional/vimscript/vvar_event_spec.lua +++ b/test/functional/vimscript/vvar_event_spec.lua @@ -1,6 +1,8 @@ -local t = require('test.functional.testutil')() -local clear, eval, eq = t.clear, t.eval, t.eq -local command = t.command +local t = require('test.testutil') +local n = require('test.functional.testnvim')() + +local clear, eval, eq = n.clear, n.eval, t.eq +local command = n.command describe('v:event', function() before_each(clear) it('is empty before any autocommand', function() diff --git a/test/functional/vimscript/wait_spec.lua b/test/functional/vimscript/wait_spec.lua index 81c406d0cc..0932bd3593 100644 --- a/test/functional/vimscript/wait_spec.lua +++ b/test/functional/vimscript/wait_spec.lua @@ -1,14 +1,16 @@ -local t = require('test.functional.testutil')() -local call = t.call -local clear = t.clear -local command = t.command -local eval = t.eval +local t = require('test.testutil') +local n = require('test.functional.testnvim')() + +local call = n.call +local clear = n.clear +local command = n.command +local eval = n.eval local eq = t.eq -local feed = t.feed -local feed_command = t.feed_command -local next_msg = t.next_msg -local api = t.api -local source = t.source +local feed = n.feed +local feed_command = n.feed_command +local next_msg = n.next_msg +local api = n.api +local source = n.source local pcall_err = t.pcall_err before_each(function() diff --git a/test/functional/vimscript/writefile_spec.lua b/test/functional/vimscript/writefile_spec.lua index 6ad527d922..404aceb92b 100644 --- a/test/functional/vimscript/writefile_spec.lua +++ b/test/functional/vimscript/writefile_spec.lua @@ -1,15 +1,16 @@ -local t = require('test.functional.testutil')() +local t = require('test.testutil') +local n = require('test.functional.testnvim')() local mkdir = t.mkdir -local clear = t.clear +local clear = n.clear local eq = t.eq -local fn = t.fn -local api = t.api -local exc_exec = t.exc_exec +local fn = n.fn +local api = n.api +local exc_exec = n.exc_exec local read_file = t.read_file local write_file = t.write_file local pcall_err = t.pcall_err -local command = t.command +local command = n.command local fname = 'Xtest-functional-eval-writefile' local dname = fname .. '.d' |