aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLewis Russell <lewis6991@gmail.com>2024-01-12 11:28:20 +0000
committerLewis Russell <lewis6991@gmail.com>2024-01-12 12:04:18 +0000
commitd33e1da9b7f7e886219cfdd20b9bbfaccdc43be9 (patch)
tree847c5c36b440434ec046b3d454581f121cc8d6c5
parent2f9ee9b6cfc61a0504fc0bc22bdf481828e2ea91 (diff)
downloadrneovim-d33e1da9b7f7e886219cfdd20b9bbfaccdc43be9.tar.gz
rneovim-d33e1da9b7f7e886219cfdd20b9bbfaccdc43be9.tar.bz2
rneovim-d33e1da9b7f7e886219cfdd20b9bbfaccdc43be9.zip
test: do not inject vim module into global helpers
-rw-r--r--test/functional/api/buffer_spec.lua2
-rw-r--r--test/functional/api/command_spec.lua2
-rw-r--r--test/functional/api/proc_spec.lua2
-rw-r--r--test/functional/api/tabpage_spec.lua2
-rw-r--r--test/functional/api/vim_spec.lua14
-rw-r--r--test/functional/api/window_spec.lua2
-rw-r--r--test/functional/core/fileio_spec.lua8
-rw-r--r--test/functional/core/job_spec.lua36
-rw-r--r--test/functional/core/startup_spec.lua10
-rw-r--r--test/functional/editor/put_spec.lua4
-rw-r--r--test/functional/ex_cmds/echo_spec.lua2
-rw-r--r--test/functional/ex_cmds/mksession_spec.lua2
-rw-r--r--test/functional/ex_cmds/swapfile_preserve_recover_spec.lua14
-rw-r--r--test/functional/helpers.lua36
-rw-r--r--test/functional/legacy/cmdline_spec.lua2
-rw-r--r--test/functional/lua/api_spec.lua2
-rw-r--r--test/functional/lua/commands_spec.lua2
-rw-r--r--test/functional/lua/diagnostic_spec.lua2
-rw-r--r--test/functional/lua/luaeval_spec.lua2
-rw-r--r--test/functional/lua/overrides_spec.lua2
-rw-r--r--test/functional/lua/secure_spec.lua4
-rw-r--r--test/functional/lua/thread_spec.lua2
-rw-r--r--test/functional/lua/vim_spec.lua6
-rw-r--r--test/functional/options/defaults_spec.lua2
-rw-r--r--test/functional/plugin/lsp/helpers.lua2
-rw-r--r--test/functional/plugin/lsp_spec.lua47
-rw-r--r--test/functional/plugin/man_spec.lua2
-rw-r--r--test/functional/plugin/msgpack_spec.lua8
-rw-r--r--test/functional/provider/ruby_spec.lua2
-rw-r--r--test/functional/terminal/edit_spec.lua2
-rw-r--r--test/functional/ui/float_spec.lua5
-rw-r--r--test/functional/ui/multibyte_spec.lua2
-rw-r--r--test/functional/ui/screen.lua4
-rw-r--r--test/functional/vimscript/ctx_functions_spec.lua4
-rw-r--r--test/functional/vimscript/input_spec.lua2
-rw-r--r--test/functional/vimscript/json_functions_spec.lua2
-rw-r--r--test/functional/vimscript/screenchar_spec.lua2
-rw-r--r--test/functional/vimscript/sort_spec.lua2
-rw-r--r--test/functional/vimscript/special_vars_spec.lua2
-rw-r--r--test/functional/vimscript/string_spec.lua2
-rw-r--r--test/helpers.lua3
-rw-r--r--test/unit/eval/typval_spec.lua2
-rw-r--r--test/unit/helpers.lua6
-rw-r--r--test/unit/os/fs_spec.lua2
44 files changed, 132 insertions, 133 deletions
diff --git a/test/functional/api/buffer_spec.lua b/test/functional/api/buffer_spec.lua
index e8fff7443d..0dd01b7299 100644
--- a/test/functional/api/buffer_spec.lua
+++ b/test/functional/api/buffer_spec.lua
@@ -11,7 +11,7 @@ local exc_exec = helpers.exc_exec
local exec_lua = helpers.exec_lua
local feed_command = helpers.feed_command
local insert = helpers.insert
-local NIL = helpers.NIL
+local NIL = vim.NIL
local command = helpers.command
local bufmeths = helpers.bufmeths
local feed = helpers.feed
diff --git a/test/functional/api/command_spec.lua b/test/functional/api/command_spec.lua
index e286181bce..6486b58db9 100644
--- a/test/functional/api/command_spec.lua
+++ b/test/functional/api/command_spec.lua
@@ -1,6 +1,6 @@
local helpers = require('test.functional.helpers')(after_each)
-local NIL = helpers.NIL
+local NIL = vim.NIL
local clear = helpers.clear
local command = helpers.command
local curbufmeths = helpers.curbufmeths
diff --git a/test/functional/api/proc_spec.lua b/test/functional/api/proc_spec.lua
index 4f99a69ce6..82a3968ab7 100644
--- a/test/functional/api/proc_spec.lua
+++ b/test/functional/api/proc_spec.lua
@@ -7,7 +7,7 @@ local neq = helpers.neq
local nvim_argv = helpers.nvim_argv
local request = helpers.request
local retry = helpers.retry
-local NIL = helpers.NIL
+local NIL = vim.NIL
local is_os = helpers.is_os
describe('API', function()
diff --git a/test/functional/api/tabpage_spec.lua b/test/functional/api/tabpage_spec.lua
index d6fc041e83..f661f8e38b 100644
--- a/test/functional/api/tabpage_spec.lua
+++ b/test/functional/api/tabpage_spec.lua
@@ -4,7 +4,7 @@ local clear, nvim, tabpage, curtab, eq, ok =
local curtabmeths = helpers.curtabmeths
local funcs = helpers.funcs
local request = helpers.request
-local NIL = helpers.NIL
+local NIL = vim.NIL
local pcall_err = helpers.pcall_err
local command = helpers.command
diff --git a/test/functional/api/vim_spec.lua b/test/functional/api/vim_spec.lua
index ce2838879b..13b80f4486 100644
--- a/test/functional/api/vim_spec.lua
+++ b/test/functional/api/vim_spec.lua
@@ -1,11 +1,11 @@
local helpers = require('test.functional.helpers')(after_each)
local Screen = require('test.functional.ui.screen')
-local luv = require('luv')
+local uv = vim.uv
local fmt = string.format
local dedent = helpers.dedent
local assert_alive = helpers.assert_alive
-local NIL = helpers.NIL
+local NIL = vim.NIL
local clear, nvim, eq, neq = helpers.clear, helpers.nvim, helpers.eq, helpers.neq
local command = helpers.command
local exec = helpers.exec
@@ -15,7 +15,7 @@ local expect = helpers.expect
local funcs = helpers.funcs
local meths = helpers.meths
local matches = helpers.matches
-local pesc = helpers.pesc
+local pesc = vim.pesc
local mkdir_p = helpers.mkdir_p
local ok, nvim_async, feed = helpers.ok, helpers.nvim_async, helpers.feed
local is_os = helpers.is_os
@@ -35,7 +35,7 @@ local pcall_err = helpers.pcall_err
local format_string = helpers.format_string
local intchar2lua = helpers.intchar2lua
local mergedicts_copy = helpers.mergedicts_copy
-local endswith = helpers.endswith
+local endswith = vim.endswith
describe('API', function()
before_each(clear)
@@ -4647,7 +4647,7 @@ describe('API', function()
end, { nargs = 1 })
]])
eq(
- luv.cwd(),
+ uv.cwd(),
meths.cmd({ cmd = 'Foo', args = { '%:p:h' }, magic = { file = true } }, { output = true })
)
end)
@@ -4806,9 +4806,9 @@ describe('API', function()
eq(1, meths.get_current_buf().id)
end)
it('works with :sleep using milliseconds', function()
- local start = luv.now()
+ local start = uv.now()
meths.cmd({ cmd = 'sleep', args = { '100m' } }, {})
- ok(luv.now() - start <= 300)
+ ok(uv.now() - start <= 300)
end)
end)
it(':call with unknown function does not crash #26289', function()
diff --git a/test/functional/api/window_spec.lua b/test/functional/api/window_spec.lua
index 7e92dd6bf3..2516e96be2 100644
--- a/test/functional/api/window_spec.lua
+++ b/test/functional/api/window_spec.lua
@@ -19,7 +19,7 @@ local curwinmeths = helpers.curwinmeths
local exec = helpers.exec
local funcs = helpers.funcs
local request = helpers.request
-local NIL = helpers.NIL
+local NIL = vim.NIL
local meths = helpers.meths
local command = helpers.command
local pcall_err = helpers.pcall_err
diff --git a/test/functional/core/fileio_spec.lua b/test/functional/core/fileio_spec.lua
index 1b9a97648c..3aaa4383b4 100644
--- a/test/functional/core/fileio_spec.lua
+++ b/test/functional/core/fileio_spec.lua
@@ -1,4 +1,4 @@
-local luv = require('luv')
+local uv = vim.uv
local helpers = require('test.functional.helpers')(after_each)
local assert_log = helpers.assert_log
@@ -19,7 +19,7 @@ local meths = helpers.meths
local mkdir = helpers.mkdir
local sleep = helpers.sleep
local read_file = helpers.read_file
-local trim = helpers.trim
+local trim = vim.trim
local currentdir = helpers.funcs.getcwd
local assert_alive = helpers.assert_alive
local check_close = helpers.check_close
@@ -210,7 +210,7 @@ describe('fileio', function()
local backup_file_name = link_file_name .. '~'
write_file('Xtest_startup_file1', initial_content, false)
- luv.fs_symlink('Xtest_startup_file1', link_file_name)
+ uv.fs_symlink('Xtest_startup_file1', link_file_name)
command('set backup')
command('set backupcopy=yes')
command('edit ' .. link_file_name)
@@ -233,7 +233,7 @@ describe('fileio', function()
local backup_file_name = backup_dir .. sep .. link_file_name .. '~'
write_file('Xtest_startup_file1', initial_content, false)
- luv.fs_symlink('Xtest_startup_file1', link_file_name)
+ uv.fs_symlink('Xtest_startup_file1', link_file_name)
mkdir(backup_dir)
command('set backup')
command('set backupcopy=yes')
diff --git a/test/functional/core/job_spec.lua b/test/functional/core/job_spec.lua
index 9c82d0bc7c..210007f027 100644
--- a/test/functional/core/job_spec.lua
+++ b/test/functional/core/job_spec.lua
@@ -1,29 +1,29 @@
local helpers = require('test.functional.helpers')(after_each)
local thelpers = require('test.functional.terminal.helpers')
-local clear, eq, eval, exc_exec, feed_command, feed, insert, neq, next_msg, nvim, testprg, ok, source, write_file, mkdir, rmdir =
- helpers.clear,
- helpers.eq,
- helpers.eval,
- helpers.exc_exec,
- helpers.feed_command,
- helpers.feed,
- helpers.insert,
- helpers.neq,
- helpers.next_msg,
- helpers.nvim,
- helpers.testprg,
- helpers.ok,
- helpers.source,
- helpers.write_file,
- helpers.mkdir,
- helpers.rmdir
+
+local clear = helpers.clear
+local eq = helpers.eq
+local eval = helpers.eval
+local exc_exec = helpers.exc_exec
+local feed_command = helpers.feed_command
+local feed = helpers.feed
+local insert = helpers.insert
+local neq = helpers.neq
+local next_msg = helpers.next_msg
+local nvim = helpers.nvim
+local testprg = helpers.testprg
+local ok = helpers.ok
+local source = helpers.source
+local write_file = helpers.write_file
+local mkdir = helpers.mkdir
+local rmdir = helpers.rmdir
local assert_alive = helpers.assert_alive
local command = helpers.command
local funcs = helpers.funcs
local os_kill = helpers.os_kill
local retry = helpers.retry
local meths = helpers.meths
-local NIL = helpers.NIL
+local NIL = vim.NIL
local poke_eventloop = helpers.poke_eventloop
local get_pathsep = helpers.get_pathsep
local pathroot = helpers.pathroot
diff --git a/test/functional/core/startup_spec.lua b/test/functional/core/startup_spec.lua
index ebf9deb86b..7953a101e1 100644
--- a/test/functional/core/startup_spec.lua
+++ b/test/functional/core/startup_spec.lua
@@ -14,7 +14,7 @@ local exec_capture = helpers.exec_capture
local exec_lua = helpers.exec_lua
local feed = helpers.feed
local funcs = helpers.funcs
-local pesc = helpers.pesc
+local pesc = vim.pesc
local mkdir = helpers.mkdir
local mkdir_p = helpers.mkdir_p
local nvim_prog = helpers.nvim_prog
@@ -23,15 +23,15 @@ local read_file = helpers.read_file
local retry = helpers.retry
local rmdir = helpers.rmdir
local sleep = helpers.sleep
-local startswith = helpers.startswith
+local startswith = vim.startswith
local write_file = helpers.write_file
local meths = helpers.meths
local alter_slashes = helpers.alter_slashes
local is_os = helpers.is_os
local dedent = helpers.dedent
-local tbl_map = helpers.tbl_map
-local tbl_filter = helpers.tbl_filter
-local endswith = helpers.endswith
+local tbl_map = vim.tbl_map
+local tbl_filter = vim.tbl_filter
+local endswith = vim.endswith
describe('startup', function()
it('--clean', function()
diff --git a/test/functional/editor/put_spec.lua b/test/functional/editor/put_spec.lua
index 8e06794093..102de5d0c1 100644
--- a/test/functional/editor/put_spec.lua
+++ b/test/functional/editor/put_spec.lua
@@ -6,8 +6,8 @@ local insert = helpers.insert
local feed = helpers.feed
local expect = helpers.expect
local eq = helpers.eq
-local map = helpers.tbl_map
-local filter = helpers.tbl_filter
+local map = vim.tbl_map
+local filter = vim.tbl_filter
local feed_command = helpers.feed_command
local command = helpers.command
local curbuf_contents = helpers.curbuf_contents
diff --git a/test/functional/ex_cmds/echo_spec.lua b/test/functional/ex_cmds/echo_spec.lua
index 4698d3de62..87bc15ceca 100644
--- a/test/functional/ex_cmds/echo_spec.lua
+++ b/test/functional/ex_cmds/echo_spec.lua
@@ -1,7 +1,7 @@
local helpers = require('test.functional.helpers')(after_each)
local eq = helpers.eq
-local NIL = helpers.NIL
+local NIL = vim.NIL
local eval = helpers.eval
local clear = helpers.clear
local meths = helpers.meths
diff --git a/test/functional/ex_cmds/mksession_spec.lua b/test/functional/ex_cmds/mksession_spec.lua
index 7d93b972d1..1885963bbc 100644
--- a/test/functional/ex_cmds/mksession_spec.lua
+++ b/test/functional/ex_cmds/mksession_spec.lua
@@ -8,7 +8,7 @@ local eq = helpers.eq
local neq = helpers.neq
local funcs = helpers.funcs
local matches = helpers.matches
-local pesc = helpers.pesc
+local pesc = vim.pesc
local rmdir = helpers.rmdir
local sleep = helpers.sleep
local meths = helpers.meths
diff --git a/test/functional/ex_cmds/swapfile_preserve_recover_spec.lua b/test/functional/ex_cmds/swapfile_preserve_recover_spec.lua
index ffecbe0841..105b488f69 100644
--- a/test/functional/ex_cmds/swapfile_preserve_recover_spec.lua
+++ b/test/functional/ex_cmds/swapfile_preserve_recover_spec.lua
@@ -1,6 +1,6 @@
local Screen = require('test.functional.ui.screen')
local helpers = require('test.functional.helpers')(after_each)
-local luv = require('luv')
+local uv = vim.uv
local eq, eval, expect, exec = helpers.eq, helpers.eval, helpers.expect, helpers.exec
local assert_alive = helpers.assert_alive
local clear = helpers.clear
@@ -12,7 +12,7 @@ local ok = helpers.ok
local rmdir = helpers.rmdir
local new_argv = helpers.new_argv
local new_pipename = helpers.new_pipename
-local pesc = helpers.pesc
+local pesc = vim.pesc
local os_kill = helpers.os_kill
local set_session = helpers.set_session
local spawn = helpers.spawn
@@ -42,7 +42,7 @@ describe(':recover', function()
end)
describe("preserve and (R)ecover with custom 'directory'", function()
- local swapdir = luv.cwd() .. '/Xtest_recover_dir'
+ local swapdir = uv.cwd() .. '/Xtest_recover_dir'
local testfile = 'Xtest_recover_file1'
-- Put swapdir at the start of the 'directory' list. #1836
-- Note: `set swapfile` *must* go after `set directory`: otherwise it may
@@ -129,7 +129,7 @@ describe("preserve and (R)ecover with custom 'directory'", function()
end)
describe('swapfile detection', function()
- local swapdir = luv.cwd() .. '/Xtest_swapdialog_dir'
+ local swapdir = uv.cwd() .. '/Xtest_swapdialog_dir'
local nvim0
-- Put swapdir at the start of the 'directory' list. #1836
-- Note: `set swapfile` *must* go after `set directory`: otherwise it may
@@ -376,8 +376,8 @@ describe('swapfile detection', function()
]])
-- pretend that the swapfile was created before boot
- local atime = os.time() - luv.uptime() - 10
- luv.fs_utime(swname, atime, atime)
+ local atime = os.time() - uv.uptime() - 10
+ uv.fs_utime(swname, atime, atime)
feed(':edit Xswaptest<CR>')
screen:expect({
@@ -412,7 +412,7 @@ describe('swapfile detection', function()
end)
describe('quitting swapfile dialog on startup stops TUI properly', function()
- local swapdir = luv.cwd() .. '/Xtest_swapquit_dir'
+ local swapdir = uv.cwd() .. '/Xtest_swapquit_dir'
local testfile = 'Xtest_swapquit_file1'
local otherfile = 'Xtest_swapquit_file2'
-- Put swapdir at the start of the 'directory' list. #1836
diff --git a/test/functional/helpers.lua b/test/functional/helpers.lua
index 9b75603d39..e4342d1dc0 100644
--- a/test/functional/helpers.lua
+++ b/test/functional/helpers.lua
@@ -1,4 +1,4 @@
-local luv = require('luv')
+local uv = vim.uv
local global_helpers = require('test.helpers')
local Session = require('test.client.session')
@@ -10,17 +10,13 @@ local check_cores = global_helpers.check_cores
local check_logs = global_helpers.check_logs
local dedent = global_helpers.dedent
local eq = global_helpers.eq
-local filter = global_helpers.tbl_filter
local is_os = global_helpers.is_os
-local map = global_helpers.tbl_map
local ok = global_helpers.ok
local sleep = global_helpers.sleep
-local tbl_contains = global_helpers.tbl_contains
local fail = global_helpers.fail
local module = {}
-local start_dir = luv.cwd()
local runtime_set = 'set runtimepath^=./build/lib/nvim/'
module.nvim_prog = (os.getenv('NVIM_PRG') or global_helpers.test_build_dir .. '/bin/nvim')
-- Default settings for the test session.
@@ -98,8 +94,8 @@ end
local session, loop_running, last_error, method_error
if not is_os('win') then
- local sigpipe_handler = luv.new_signal()
- luv.signal_start(sigpipe_handler, 'sigpipe', function()
+ local sigpipe_handler = uv.new_signal()
+ uv.signal_start(sigpipe_handler, 'sigpipe', function()
print('warning: got SIGPIPE signal. Likely related to a crash in nvim')
end)
end
@@ -204,7 +200,7 @@ function module.expect_msg_seq(...)
)
)
)
- elseif tbl_contains(ignore, msg_type) then
+ elseif vim.tbl_contains(ignore, msg_type) then
nr_ignored = nr_ignored + 1
else
table.insert(actual_seq, msg)
@@ -408,11 +404,11 @@ local function remove_args(args, args_rm)
end
local last = ''
for _, arg in ipairs(args) do
- if tbl_contains(skip_following, last) then
+ if vim.tbl_contains(skip_following, last) then
last = ''
- elseif tbl_contains(args_rm, arg) then
+ elseif vim.tbl_contains(args_rm, arg) then
last = arg
- elseif arg == runtime_set and tbl_contains(args_rm, 'runtimepath') then
+ elseif arg == runtime_set and vim.tbl_contains(args_rm, 'runtimepath') then
table.remove(new_args) -- Remove the preceding "--cmd".
last = ''
else
@@ -426,10 +422,10 @@ function module.check_close()
if not session then
return
end
- local start_time = luv.now()
+ local start_time = uv.now()
session:close()
- luv.update_time() -- Update cached value of luv.now() (libuv: uv_now()).
- local end_time = luv.now()
+ uv.update_time() -- Update cached value of luv.now() (libuv: uv_now()).
+ local end_time = uv.now()
local delta = end_time - start_time
if delta > 500 then
print(
@@ -774,7 +770,7 @@ function module.assert_visible(bufnr, visible)
end
local function do_rmdir(path)
- local stat = luv.fs_stat(path)
+ local stat = uv.fs_stat(path)
if stat == nil then
return
end
@@ -803,12 +799,14 @@ local function do_rmdir(path)
end
end
end
- local ret, err = luv.fs_rmdir(path)
+ local ret, err = uv.fs_rmdir(path)
if not ret then
error('luv.fs_rmdir(' .. path .. '): ' .. err)
end
end
+local start_dir = uv.cwd()
+
function module.rmdir(path)
local ret, _ = pcall(do_rmdir, path)
if not ret and is_os('win') then
@@ -959,12 +957,12 @@ end
function module.parse_context(ctx)
local parsed = {}
for _, item in ipairs({ 'regs', 'jumps', 'bufs', 'gvars' }) do
- parsed[item] = filter(function(v)
+ parsed[item] = vim.tbl_filter(function(v)
return type(v) == 'table'
end, module.call('msgpackparse', ctx[item]))
end
parsed['bufs'] = parsed['bufs'][1]
- return map(function(v)
+ return vim.tbl_map(function(v)
if #v == 0 then
return nil
end
@@ -993,7 +991,7 @@ function module.mkdir_p(path)
end
--- @class test.functional.helpers: test.helpers
-module = global_helpers.tbl_extend('error', module, global_helpers)
+module = vim.tbl_extend('error', module, global_helpers)
--- @return test.functional.helpers
return function(after_each)
diff --git a/test/functional/legacy/cmdline_spec.lua b/test/functional/legacy/cmdline_spec.lua
index 99731bb80b..8e2ef2aabd 100644
--- a/test/functional/legacy/cmdline_spec.lua
+++ b/test/functional/legacy/cmdline_spec.lua
@@ -6,7 +6,7 @@ local feed = helpers.feed
local feed_command = helpers.feed_command
local exec = helpers.exec
local meths = helpers.meths
-local pesc = helpers.pesc
+local pesc = vim.pesc
describe('cmdline', function()
before_each(clear)
diff --git a/test/functional/lua/api_spec.lua b/test/functional/lua/api_spec.lua
index 55f9ba7e13..d10802440f 100644
--- a/test/functional/lua/api_spec.lua
+++ b/test/functional/lua/api_spec.lua
@@ -6,7 +6,7 @@ local remove_trace = helpers.remove_trace
local funcs = helpers.funcs
local clear = helpers.clear
local eval = helpers.eval
-local NIL = helpers.NIL
+local NIL = vim.NIL
local eq = helpers.eq
local exec_lua = helpers.exec_lua
local pcall_err = helpers.pcall_err
diff --git a/test/functional/lua/commands_spec.lua b/test/functional/lua/commands_spec.lua
index b7bf2b2eae..8d5badb92b 100644
--- a/test/functional/lua/commands_spec.lua
+++ b/test/functional/lua/commands_spec.lua
@@ -3,7 +3,7 @@ local helpers = require('test.functional.helpers')(after_each)
local Screen = require('test.functional.ui.screen')
local eq = helpers.eq
-local NIL = helpers.NIL
+local NIL = vim.NIL
local eval = helpers.eval
local feed = helpers.feed
local clear = helpers.clear
diff --git a/test/functional/lua/diagnostic_spec.lua b/test/functional/lua/diagnostic_spec.lua
index 22ef66bc60..de1c139344 100644
--- a/test/functional/lua/diagnostic_spec.lua
+++ b/test/functional/lua/diagnostic_spec.lua
@@ -1,6 +1,6 @@
local helpers = require('test.functional.helpers')(after_each)
-local NIL = helpers.NIL
+local NIL = vim.NIL
local command = helpers.command
local clear = helpers.clear
local exec_lua = helpers.exec_lua
diff --git a/test/functional/lua/luaeval_spec.lua b/test/functional/lua/luaeval_spec.lua
index 45a7258884..5efc15417a 100644
--- a/test/functional/lua/luaeval_spec.lua
+++ b/test/functional/lua/luaeval_spec.lua
@@ -12,7 +12,7 @@ local funcs = helpers.funcs
local clear = helpers.clear
local eval = helpers.eval
local feed = helpers.feed
-local NIL = helpers.NIL
+local NIL = vim.NIL
local eq = helpers.eq
before_each(clear)
diff --git a/test/functional/lua/overrides_spec.lua b/test/functional/lua/overrides_spec.lua
index 0f1c7d8a51..00458ecc34 100644
--- a/test/functional/lua/overrides_spec.lua
+++ b/test/functional/lua/overrides_spec.lua
@@ -3,7 +3,7 @@ local helpers = require('test.functional.helpers')(after_each)
local Screen = require('test.functional.ui.screen')
local eq = helpers.eq
-local NIL = helpers.NIL
+local NIL = vim.NIL
local feed = helpers.feed
local clear = helpers.clear
local funcs = helpers.funcs
diff --git a/test/functional/lua/secure_spec.lua b/test/functional/lua/secure_spec.lua
index 52770867a8..05311d153f 100644
--- a/test/functional/lua/secure_spec.lua
+++ b/test/functional/lua/secure_spec.lua
@@ -73,7 +73,7 @@ describe('vim.secure', function()
local trust = helpers.read_file(funcs.stdpath('state') .. pathsep .. 'trust')
eq(string.format('! %s', cwd .. pathsep .. 'Xfile'), vim.trim(trust))
- eq(helpers.NIL, exec_lua([[return vim.secure.read('Xfile')]]))
+ eq(vim.NIL, exec_lua([[return vim.secure.read('Xfile')]]))
os.remove(funcs.stdpath('state') .. pathsep .. 'trust')
@@ -103,7 +103,7 @@ describe('vim.secure', function()
local hash = funcs.sha256(helpers.read_file('Xfile'))
trust = helpers.read_file(funcs.stdpath('state') .. pathsep .. 'trust')
eq(string.format('%s %s', hash, cwd .. pathsep .. 'Xfile'), vim.trim(trust))
- eq(helpers.NIL, exec_lua([[vim.secure.read('Xfile')]]))
+ eq(vim.NIL, exec_lua([[vim.secure.read('Xfile')]]))
os.remove(funcs.stdpath('state') .. pathsep .. 'trust')
diff --git a/test/functional/lua/thread_spec.lua b/test/functional/lua/thread_spec.lua
index 0a7a7f0448..c1981e19d4 100644
--- a/test/functional/lua/thread_spec.lua
+++ b/test/functional/lua/thread_spec.lua
@@ -6,7 +6,7 @@ local feed = helpers.feed
local eq = helpers.eq
local exec_lua = helpers.exec_lua
local next_msg = helpers.next_msg
-local NIL = helpers.NIL
+local NIL = vim.NIL
local pcall_err = helpers.pcall_err
describe('thread', function()
diff --git a/test/functional/lua/vim_spec.lua b/test/functional/lua/vim_spec.lua
index 4ebba827ef..d38d8eaf90 100644
--- a/test/functional/lua/vim_spec.lua
+++ b/test/functional/lua/vim_spec.lua
@@ -11,14 +11,14 @@ local insert = helpers.insert
local clear = helpers.clear
local eq = helpers.eq
local ok = helpers.ok
-local pesc = helpers.pesc
+local pesc = vim.pesc
local eval = helpers.eval
local feed = helpers.feed
local pcall_err = helpers.pcall_err
local exec_lua = helpers.exec_lua
local matches = helpers.matches
local exec = helpers.exec
-local NIL = helpers.NIL
+local NIL = vim.NIL
local retry = helpers.retry
local next_msg = helpers.next_msg
local remove_trace = helpers.remove_trace
@@ -1196,7 +1196,7 @@ describe('lua stdlib', function()
end)
]])
- helpers.poke_eventloop()
+ poke_eventloop()
eq('hello', exec_lua [[return vim.g.fnres]])
end)
diff --git a/test/functional/options/defaults_spec.lua b/test/functional/options/defaults_spec.lua
index 1d5f657542..b68682e2bd 100644
--- a/test/functional/options/defaults_spec.lua
+++ b/test/functional/options/defaults_spec.lua
@@ -18,7 +18,7 @@ local neq = helpers.neq
local mkdir = helpers.mkdir
local rmdir = helpers.rmdir
local alter_slashes = helpers.alter_slashes
-local tbl_contains = helpers.tbl_contains
+local tbl_contains = vim.tbl_contains
local expect_exit = helpers.expect_exit
local is_os = helpers.is_os
diff --git a/test/functional/plugin/lsp/helpers.lua b/test/functional/plugin/lsp/helpers.lua
index f641b42727..97fa108500 100644
--- a/test/functional/plugin/lsp/helpers.lua
+++ b/test/functional/plugin/lsp/helpers.lua
@@ -4,7 +4,7 @@ local clear = helpers.clear
local exec_lua = helpers.exec_lua
local run = helpers.run
local stop = helpers.stop
-local NIL = helpers.NIL
+local NIL = vim.NIL
local M = {}
diff --git a/test/functional/plugin/lsp_spec.lua b/test/functional/plugin/lsp_spec.lua
index 86b9be79e0..d794a34463 100644
--- a/test/functional/plugin/lsp_spec.lua
+++ b/test/functional/plugin/lsp_spec.lua
@@ -11,12 +11,12 @@ local eq = helpers.eq
local eval = helpers.eval
local matches = helpers.matches
local pcall_err = helpers.pcall_err
-local pesc = helpers.pesc
+local pesc = vim.pesc
local insert = helpers.insert
local funcs = helpers.funcs
local retry = helpers.retry
local stop = helpers.stop
-local NIL = helpers.NIL
+local NIL = vim.NIL
local read_file = require('test.helpers').read_file
local write_file = require('test.helpers').write_file
local is_ci = helpers.is_ci
@@ -24,6 +24,7 @@ local meths = helpers.meths
local is_os = helpers.is_os
local skip = helpers.skip
local mkdir = helpers.mkdir
+local tmpname = helpers.tmpname
local clear_notrace = lsp_helpers.clear_notrace
local create_server_definition = lsp_helpers.create_server_definition
@@ -728,8 +729,8 @@ describe('LSP', function()
on_handler = function(err, result, ctx)
eq(table.remove(expected_handlers), { err, result, ctx }, 'expected handler')
if ctx.method == 'start' then
- local tmpfile_old = helpers.tmpname()
- local tmpfile_new = helpers.tmpname()
+ local tmpfile_old = tmpname()
+ local tmpfile_new = tmpname()
os.remove(tmpfile_new)
exec_lua(
[=[
@@ -2278,7 +2279,7 @@ describe('LSP', function()
)
end)
it('Supports file creation with CreateFile payload', function()
- local tmpfile = helpers.tmpname()
+ local tmpfile = tmpname()
os.remove(tmpfile) -- Should not exist, only interested in a tmpname
local uri = exec_lua('return vim.uri_from_fname(...)', tmpfile)
local edit = {
@@ -2295,7 +2296,7 @@ describe('LSP', function()
it(
'Supports file creation in folder that needs to be created with CreateFile payload',
function()
- local tmpfile = helpers.tmpname()
+ local tmpfile = tmpname()
os.remove(tmpfile) -- Should not exist, only interested in a tmpname
tmpfile = tmpfile .. '/dummy/x/'
local uri = exec_lua('return vim.uri_from_fname(...)', tmpfile)
@@ -2312,7 +2313,7 @@ describe('LSP', function()
end
)
it('createFile does not touch file if it exists and ignoreIfExists is set', function()
- local tmpfile = helpers.tmpname()
+ local tmpfile = tmpname()
write_file(tmpfile, 'Dummy content')
local uri = exec_lua('return vim.uri_from_fname(...)', tmpfile)
local edit = {
@@ -2331,7 +2332,7 @@ describe('LSP', function()
eq('Dummy content', read_file(tmpfile))
end)
it('createFile overrides file if overwrite is set', function()
- local tmpfile = helpers.tmpname()
+ local tmpfile = tmpname()
write_file(tmpfile, 'Dummy content')
local uri = exec_lua('return vim.uri_from_fname(...)', tmpfile)
local edit = {
@@ -2351,7 +2352,7 @@ describe('LSP', function()
eq('', read_file(tmpfile))
end)
it('DeleteFile delete file and buffer', function()
- local tmpfile = helpers.tmpname()
+ local tmpfile = tmpname()
write_file(tmpfile, 'Be gone')
local uri = exec_lua(
[[
@@ -2375,7 +2376,7 @@ describe('LSP', function()
eq(false, exec_lua('return vim.api.nvim_buf_is_loaded(vim.fn.bufadd(...))', tmpfile))
end)
it('DeleteFile fails if file does not exist and ignoreIfNotExists is false', function()
- local tmpfile = helpers.tmpname()
+ local tmpfile = tmpname()
os.remove(tmpfile)
local uri = exec_lua('return vim.uri_from_fname(...)', tmpfile)
local edit = {
@@ -2398,9 +2399,9 @@ describe('LSP', function()
local pathsep = helpers.get_pathsep()
it('Can rename an existing file', function()
- local old = helpers.tmpname()
+ local old = tmpname()
write_file(old, 'Test content')
- local new = helpers.tmpname()
+ local new = tmpname()
os.remove(new) -- only reserve the name, file must not exist for the test scenario
local lines = exec_lua(
[[
@@ -2424,9 +2425,9 @@ describe('LSP', function()
os.remove(new)
end)
it('Kills old buffer after renaming an existing file', function()
- local old = helpers.tmpname()
+ local old = tmpname()
write_file(old, 'Test content')
- local new = helpers.tmpname()
+ local new = tmpname()
os.remove(new) -- only reserve the name, file must not exist for the test scenario
local lines = exec_lua(
[[
@@ -2444,8 +2445,8 @@ describe('LSP', function()
end)
it('Can rename a directory', function()
-- only reserve the name, file must not exist for the test scenario
- local old_dir = helpers.tmpname()
- local new_dir = helpers.tmpname()
+ local old_dir = tmpname()
+ local new_dir = tmpname()
os.remove(old_dir)
os.remove(new_dir)
@@ -2479,9 +2480,9 @@ describe('LSP', function()
it(
'Does not rename file if target exists and ignoreIfExists is set or overwrite is false',
function()
- local old = helpers.tmpname()
+ local old = tmpname()
write_file(old, 'Old File')
- local new = helpers.tmpname()
+ local new = tmpname()
write_file(new, 'New file')
exec_lua(
@@ -2514,9 +2515,9 @@ describe('LSP', function()
end
)
it('Does override target if overwrite is true', function()
- local old = helpers.tmpname()
+ local old = tmpname()
write_file(old, 'Old file')
- local new = helpers.tmpname()
+ local new = tmpname()
write_file(new, 'New file')
exec_lua(
[[
@@ -4043,7 +4044,7 @@ describe('LSP', function()
if is_os('win') then
tmpfile = '\\\\.\\\\pipe\\pipe.test'
else
- tmpfile = helpers.tmpname()
+ tmpfile = tmpname()
os.remove(tmpfile)
end
local result = exec_lua(
@@ -4150,7 +4151,7 @@ describe('LSP', function()
describe('#dynamic vim.lsp._dynamic', function()
it('supports dynamic registration', function()
---@type string
- local root_dir = helpers.tmpname()
+ local root_dir = tmpname()
os.remove(root_dir)
mkdir(root_dir)
local tmpfile = root_dir .. '/dynamic.foo'
@@ -4261,7 +4262,7 @@ describe('LSP', function()
describe('vim.lsp._watchfiles', function()
it('sends notifications when files change', function()
skip(is_os('bsd'), 'bsd only reports rename on folders if file inside change')
- local root_dir = helpers.tmpname()
+ local root_dir = tmpname()
os.remove(root_dir)
mkdir(root_dir)
diff --git a/test/functional/plugin/man_spec.lua b/test/functional/plugin/man_spec.lua
index ed9f21edf3..532210582a 100644
--- a/test/functional/plugin/man_spec.lua
+++ b/test/functional/plugin/man_spec.lua
@@ -9,7 +9,7 @@ local matches = helpers.matches
local write_file = helpers.write_file
local tmpname = helpers.tmpname
local eq = helpers.eq
-local pesc = helpers.pesc
+local pesc = vim.pesc
local skip = helpers.skip
local is_ci = helpers.is_ci
diff --git a/test/functional/plugin/msgpack_spec.lua b/test/functional/plugin/msgpack_spec.lua
index 01dd253384..985252fd75 100644
--- a/test/functional/plugin/msgpack_spec.lua
+++ b/test/functional/plugin/msgpack_spec.lua
@@ -1,10 +1,12 @@
local helpers = require('test.functional.helpers')(after_each)
local clear = helpers.clear
local meths = helpers.meths
-local eq, nvim_eval, nvim_command, exc_exec =
- helpers.eq, helpers.eval, helpers.command, helpers.exc_exec
+local eq = helpers.eq
+local nvim_eval = helpers.eval
+local nvim_command = helpers.command
+local exc_exec = helpers.exc_exec
local ok = helpers.ok
-local NIL = helpers.NIL
+local NIL = vim.NIL
describe('autoload/msgpack.vim', function()
before_each(function()
diff --git a/test/functional/provider/ruby_spec.lua b/test/functional/provider/ruby_spec.lua
index 56919d401c..438f41450a 100644
--- a/test/functional/provider/ruby_spec.lua
+++ b/test/functional/provider/ruby_spec.lua
@@ -116,7 +116,7 @@ describe('rubyeval()', function()
end)
it('returns nil for empty strings', function()
- eq(helpers.NIL, funcs.rubyeval(''))
+ eq(vim.NIL, funcs.rubyeval(''))
end)
it('errors out when given non-string', function()
diff --git a/test/functional/terminal/edit_spec.lua b/test/functional/terminal/edit_spec.lua
index e9062bc9b5..7625e09891 100644
--- a/test/functional/terminal/edit_spec.lua
+++ b/test/functional/terminal/edit_spec.lua
@@ -10,7 +10,7 @@ local meths = helpers.meths
local clear = helpers.clear
local eq = helpers.eq
local matches = helpers.matches
-local pesc = helpers.pesc
+local pesc = vim.pesc
describe(':edit term://*', function()
local get_screen = function(columns, lines)
diff --git a/test/functional/ui/float_spec.lua b/test/functional/ui/float_spec.lua
index 5a78e2baa9..6febb2e2df 100644
--- a/test/functional/ui/float_spec.lua
+++ b/test/functional/ui/float_spec.lua
@@ -1,6 +1,5 @@
local helpers = require('test.functional.helpers')(after_each)
local Screen = require('test.functional.ui.screen')
-local global_helpers = require('test.helpers')
local os = require('os')
local clear, feed = helpers.clear, helpers.feed
local assert_alive = helpers.assert_alive
@@ -17,9 +16,9 @@ local curbufmeths = helpers.curbufmeths
local funcs = helpers.funcs
local run = helpers.run
local pcall_err = helpers.pcall_err
-local tbl_contains = global_helpers.tbl_contains
+local tbl_contains = vim.tbl_contains
local curbuf, curwin, curtab = helpers.curbuf, helpers.curwin, helpers.curtab
-local NIL = helpers.NIL
+local NIL = vim.NIL
describe('float window', function()
before_each(function()
diff --git a/test/functional/ui/multibyte_spec.lua b/test/functional/ui/multibyte_spec.lua
index 8077194533..bb65ea4cc4 100644
--- a/test/functional/ui/multibyte_spec.lua
+++ b/test/functional/ui/multibyte_spec.lua
@@ -7,7 +7,7 @@ local feed_command = helpers.feed_command
local insert = helpers.insert
local funcs = helpers.funcs
local meths = helpers.meths
-local split = helpers.split
+local split = vim.split
local dedent = helpers.dedent
describe('multibyte rendering', function()
diff --git a/test/functional/ui/screen.lua b/test/functional/ui/screen.lua
index 47e343789a..07bb1c3258 100644
--- a/test/functional/ui/screen.lua
+++ b/test/functional/ui/screen.lua
@@ -72,10 +72,10 @@
local helpers = require('test.functional.helpers')(nil)
local busted = require('busted')
-local deepcopy = helpers.deepcopy
+local deepcopy = vim.deepcopy
local shallowcopy = helpers.shallowcopy
local concat_tables = helpers.concat_tables
-local pesc = helpers.pesc
+local pesc = vim.pesc
local run_session = helpers.run_session
local eq = helpers.eq
local dedent = helpers.dedent
diff --git a/test/functional/vimscript/ctx_functions_spec.lua b/test/functional/vimscript/ctx_functions_spec.lua
index 01daeddbab..c336f3cb2d 100644
--- a/test/functional/vimscript/ctx_functions_spec.lua
+++ b/test/functional/vimscript/ctx_functions_spec.lua
@@ -6,12 +6,12 @@ local command = helpers.command
local eq = helpers.eq
local eval = helpers.eval
local feed = helpers.feed
-local map = helpers.tbl_map
+local map = vim.tbl_map
local nvim = helpers.nvim
local parse_context = helpers.parse_context
local exec_capture = helpers.exec_capture
local source = helpers.source
-local trim = helpers.trim
+local trim = vim.trim
local write_file = helpers.write_file
local pcall_err = helpers.pcall_err
diff --git a/test/functional/vimscript/input_spec.lua b/test/functional/vimscript/input_spec.lua
index 8a634a6700..52c28869ff 100644
--- a/test/functional/vimscript/input_spec.lua
+++ b/test/functional/vimscript/input_spec.lua
@@ -10,7 +10,7 @@ local command = helpers.command
local exc_exec = helpers.exc_exec
local pcall_err = helpers.pcall_err
local async_meths = helpers.async_meths
-local NIL = helpers.NIL
+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 a93caf8405..e469b45b34 100644
--- a/test/functional/vimscript/json_functions_spec.lua
+++ b/test/functional/vimscript/json_functions_spec.lua
@@ -7,7 +7,7 @@ local eval = helpers.eval
local command = helpers.command
local exc_exec = helpers.exc_exec
local pcall_err = helpers.pcall_err
-local NIL = helpers.NIL
+local NIL = vim.NIL
local source = helpers.source
describe('json_decode() function', function()
diff --git a/test/functional/vimscript/screenchar_spec.lua b/test/functional/vimscript/screenchar_spec.lua
index 767e3c57ef..5df9c480e8 100644
--- a/test/functional/vimscript/screenchar_spec.lua
+++ b/test/functional/vimscript/screenchar_spec.lua
@@ -1,7 +1,7 @@
local helpers = require('test.functional.helpers')(after_each)
local clear, eq, neq = helpers.clear, helpers.eq, helpers.neq
local command, meths, funcs = helpers.command, helpers.meths, helpers.funcs
-local tbl_deep_extend = helpers.tbl_deep_extend
+local tbl_deep_extend = vim.tbl_deep_extend
-- Set up two overlapping floating windows
local setup_floating_windows = function()
diff --git a/test/functional/vimscript/sort_spec.lua b/test/functional/vimscript/sort_spec.lua
index a5119a737f..ca769b9f16 100644
--- a/test/functional/vimscript/sort_spec.lua
+++ b/test/functional/vimscript/sort_spec.lua
@@ -1,7 +1,7 @@
local helpers = require('test.functional.helpers')(after_each)
local eq = helpers.eq
-local NIL = helpers.NIL
+local NIL = vim.NIL
local eval = helpers.eval
local clear = helpers.clear
local meths = helpers.meths
diff --git a/test/functional/vimscript/special_vars_spec.lua b/test/functional/vimscript/special_vars_spec.lua
index 4266336652..80c3c45561 100644
--- a/test/functional/vimscript/special_vars_spec.lua
+++ b/test/functional/vimscript/special_vars_spec.lua
@@ -6,7 +6,7 @@ local clear = helpers.clear
local eval = helpers.eval
local eq = helpers.eq
local meths = helpers.meths
-local NIL = helpers.NIL
+local NIL = vim.NIL
describe('Special values', function()
before_each(clear)
diff --git a/test/functional/vimscript/string_spec.lua b/test/functional/vimscript/string_spec.lua
index 719fea2c96..aa93ddb27f 100644
--- a/test/functional/vimscript/string_spec.lua
+++ b/test/functional/vimscript/string_spec.lua
@@ -7,7 +7,7 @@ local eval = helpers.eval
local exc_exec = helpers.exc_exec
local pcall_err = helpers.pcall_err
local funcs = helpers.funcs
-local NIL = helpers.NIL
+local NIL = vim.NIL
local source = helpers.source
describe('string() function', function()
diff --git a/test/helpers.lua b/test/helpers.lua
index 83f87c856b..0f854e5695 100644
--- a/test/helpers.lua
+++ b/test/helpers.lua
@@ -1,4 +1,3 @@
-local shared = vim
local luaassert = require('luassert')
local busted = require('busted')
local luv = require('luv')
@@ -954,6 +953,6 @@ function module.mkdir(path)
return luv.fs_mkdir(path, 493)
end
-module = shared.tbl_extend('error', module, Paths, shared, require('test.deprecated'))
+module = vim.tbl_extend('error', module, Paths, require('test.deprecated'))
return module
diff --git a/test/unit/eval/typval_spec.lua b/test/unit/eval/typval_spec.lua
index da70b8feba..6edd164438 100644
--- a/test/unit/eval/typval_spec.lua
+++ b/test/unit/eval/typval_spec.lua
@@ -14,7 +14,7 @@ local cimport = helpers.cimport
local to_cstr = helpers.to_cstr
local alloc_log_new = helpers.alloc_log_new
local concat_tables = helpers.concat_tables
-local map = helpers.tbl_map
+local map = vim.tbl_map
local a = eval_helpers.alloc_logging_helpers
local int = eval_helpers.int
diff --git a/test/unit/helpers.lua b/test/unit/helpers.lua
index 86d02e8c31..47499d98fa 100644
--- a/test/unit/helpers.lua
+++ b/test/unit/helpers.lua
@@ -10,9 +10,9 @@ local say = require('say')
local check_cores = global_helpers.check_cores
local dedent = global_helpers.dedent
local neq = global_helpers.neq
-local map = global_helpers.tbl_map
+local map = vim.tbl_map
local eq = global_helpers.eq
-local trim = global_helpers.trim
+local trim = vim.trim
-- add some standard header locations
for _, p in ipairs(Paths.include_paths) do
@@ -904,7 +904,7 @@ local module = {
is_asan = is_asan,
}
--- @class test.unit.helpers: test.unit.helpers.module, test.helpers
-module = global_helpers.tbl_extend('error', module, global_helpers)
+module = vim.tbl_extend('error', module, global_helpers)
return function()
return module
diff --git a/test/unit/os/fs_spec.lua b/test/unit/os/fs_spec.lua
index e635fc9667..0a0aeaa35e 100644
--- a/test/unit/os/fs_spec.lua
+++ b/test/unit/os/fs_spec.lua
@@ -17,7 +17,7 @@ local OK = helpers.OK
local FAIL = helpers.FAIL
local NULL = helpers.NULL
local mkdir = helpers.mkdir
-local endswith = helpers.endswith
+local endswith = vim.endswith
local NODE_NORMAL = 0
local NODE_WRITABLE = 1