mirror of
https://github.com/neovim/neovim.git
synced 2024-09-17 20:58:20 -04:00
test: do not inject vim module into global helpers
This commit is contained in:
parent
2f9ee9b6cf
commit
d33e1da9b7
@ -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
|
||||
|
@ -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
|
||||
|
@ -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()
|
||||
|
@ -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
|
||||
|
||||
|
@ -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()
|
||||
|
@ -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
|
||||
|
@ -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')
|
||||
|
@ -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
|
||||
|
@ -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()
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
|
@ -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)
|
||||
|
@ -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)
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
|
@ -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)
|
||||
|
@ -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
|
||||
|
@ -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')
|
||||
|
||||
|
@ -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()
|
||||
|
@ -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)
|
||||
|
||||
|
@ -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
|
||||
|
||||
|
@ -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 = {}
|
||||
|
||||
|
@ -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)
|
||||
|
||||
|
@ -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
|
||||
|
||||
|
@ -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()
|
||||
|
@ -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()
|
||||
|
@ -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)
|
||||
|
@ -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()
|
||||
|
@ -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()
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
|
||||
|
@ -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
|
||||
|
||||
|
@ -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()
|
||||
|
@ -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()
|
||||
|
@ -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
|
||||
|
@ -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)
|
||||
|
@ -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()
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
|
Loading…
Reference in New Issue
Block a user