mirror of
https://github.com/neovim/neovim.git
synced 2025-02-25 18:55:25 -06: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 exec_lua = helpers.exec_lua
|
||||||
local feed_command = helpers.feed_command
|
local feed_command = helpers.feed_command
|
||||||
local insert = helpers.insert
|
local insert = helpers.insert
|
||||||
local NIL = helpers.NIL
|
local NIL = vim.NIL
|
||||||
local command = helpers.command
|
local command = helpers.command
|
||||||
local bufmeths = helpers.bufmeths
|
local bufmeths = helpers.bufmeths
|
||||||
local feed = helpers.feed
|
local feed = helpers.feed
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
local helpers = require('test.functional.helpers')(after_each)
|
local helpers = require('test.functional.helpers')(after_each)
|
||||||
|
|
||||||
local NIL = helpers.NIL
|
local NIL = vim.NIL
|
||||||
local clear = helpers.clear
|
local clear = helpers.clear
|
||||||
local command = helpers.command
|
local command = helpers.command
|
||||||
local curbufmeths = helpers.curbufmeths
|
local curbufmeths = helpers.curbufmeths
|
||||||
|
@ -7,7 +7,7 @@ local neq = helpers.neq
|
|||||||
local nvim_argv = helpers.nvim_argv
|
local nvim_argv = helpers.nvim_argv
|
||||||
local request = helpers.request
|
local request = helpers.request
|
||||||
local retry = helpers.retry
|
local retry = helpers.retry
|
||||||
local NIL = helpers.NIL
|
local NIL = vim.NIL
|
||||||
local is_os = helpers.is_os
|
local is_os = helpers.is_os
|
||||||
|
|
||||||
describe('API', function()
|
describe('API', function()
|
||||||
|
@ -4,7 +4,7 @@ local clear, nvim, tabpage, curtab, eq, ok =
|
|||||||
local curtabmeths = helpers.curtabmeths
|
local curtabmeths = helpers.curtabmeths
|
||||||
local funcs = helpers.funcs
|
local funcs = helpers.funcs
|
||||||
local request = helpers.request
|
local request = helpers.request
|
||||||
local NIL = helpers.NIL
|
local NIL = vim.NIL
|
||||||
local pcall_err = helpers.pcall_err
|
local pcall_err = helpers.pcall_err
|
||||||
local command = helpers.command
|
local command = helpers.command
|
||||||
|
|
||||||
|
@ -1,11 +1,11 @@
|
|||||||
local helpers = require('test.functional.helpers')(after_each)
|
local helpers = require('test.functional.helpers')(after_each)
|
||||||
local Screen = require('test.functional.ui.screen')
|
local Screen = require('test.functional.ui.screen')
|
||||||
local luv = require('luv')
|
local uv = vim.uv
|
||||||
|
|
||||||
local fmt = string.format
|
local fmt = string.format
|
||||||
local dedent = helpers.dedent
|
local dedent = helpers.dedent
|
||||||
local assert_alive = helpers.assert_alive
|
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 clear, nvim, eq, neq = helpers.clear, helpers.nvim, helpers.eq, helpers.neq
|
||||||
local command = helpers.command
|
local command = helpers.command
|
||||||
local exec = helpers.exec
|
local exec = helpers.exec
|
||||||
@ -15,7 +15,7 @@ local expect = helpers.expect
|
|||||||
local funcs = helpers.funcs
|
local funcs = helpers.funcs
|
||||||
local meths = helpers.meths
|
local meths = helpers.meths
|
||||||
local matches = helpers.matches
|
local matches = helpers.matches
|
||||||
local pesc = helpers.pesc
|
local pesc = vim.pesc
|
||||||
local mkdir_p = helpers.mkdir_p
|
local mkdir_p = helpers.mkdir_p
|
||||||
local ok, nvim_async, feed = helpers.ok, helpers.nvim_async, helpers.feed
|
local ok, nvim_async, feed = helpers.ok, helpers.nvim_async, helpers.feed
|
||||||
local is_os = helpers.is_os
|
local is_os = helpers.is_os
|
||||||
@ -35,7 +35,7 @@ local pcall_err = helpers.pcall_err
|
|||||||
local format_string = helpers.format_string
|
local format_string = helpers.format_string
|
||||||
local intchar2lua = helpers.intchar2lua
|
local intchar2lua = helpers.intchar2lua
|
||||||
local mergedicts_copy = helpers.mergedicts_copy
|
local mergedicts_copy = helpers.mergedicts_copy
|
||||||
local endswith = helpers.endswith
|
local endswith = vim.endswith
|
||||||
|
|
||||||
describe('API', function()
|
describe('API', function()
|
||||||
before_each(clear)
|
before_each(clear)
|
||||||
@ -4647,7 +4647,7 @@ describe('API', function()
|
|||||||
end, { nargs = 1 })
|
end, { nargs = 1 })
|
||||||
]])
|
]])
|
||||||
eq(
|
eq(
|
||||||
luv.cwd(),
|
uv.cwd(),
|
||||||
meths.cmd({ cmd = 'Foo', args = { '%:p:h' }, magic = { file = true } }, { output = true })
|
meths.cmd({ cmd = 'Foo', args = { '%:p:h' }, magic = { file = true } }, { output = true })
|
||||||
)
|
)
|
||||||
end)
|
end)
|
||||||
@ -4806,9 +4806,9 @@ describe('API', function()
|
|||||||
eq(1, meths.get_current_buf().id)
|
eq(1, meths.get_current_buf().id)
|
||||||
end)
|
end)
|
||||||
it('works with :sleep using milliseconds', function()
|
it('works with :sleep using milliseconds', function()
|
||||||
local start = luv.now()
|
local start = uv.now()
|
||||||
meths.cmd({ cmd = 'sleep', args = { '100m' } }, {})
|
meths.cmd({ cmd = 'sleep', args = { '100m' } }, {})
|
||||||
ok(luv.now() - start <= 300)
|
ok(uv.now() - start <= 300)
|
||||||
end)
|
end)
|
||||||
end)
|
end)
|
||||||
it(':call with unknown function does not crash #26289', function()
|
it(':call with unknown function does not crash #26289', function()
|
||||||
|
@ -19,7 +19,7 @@ local curwinmeths = helpers.curwinmeths
|
|||||||
local exec = helpers.exec
|
local exec = helpers.exec
|
||||||
local funcs = helpers.funcs
|
local funcs = helpers.funcs
|
||||||
local request = helpers.request
|
local request = helpers.request
|
||||||
local NIL = helpers.NIL
|
local NIL = vim.NIL
|
||||||
local meths = helpers.meths
|
local meths = helpers.meths
|
||||||
local command = helpers.command
|
local command = helpers.command
|
||||||
local pcall_err = helpers.pcall_err
|
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 helpers = require('test.functional.helpers')(after_each)
|
||||||
|
|
||||||
local assert_log = helpers.assert_log
|
local assert_log = helpers.assert_log
|
||||||
@ -19,7 +19,7 @@ local meths = helpers.meths
|
|||||||
local mkdir = helpers.mkdir
|
local mkdir = helpers.mkdir
|
||||||
local sleep = helpers.sleep
|
local sleep = helpers.sleep
|
||||||
local read_file = helpers.read_file
|
local read_file = helpers.read_file
|
||||||
local trim = helpers.trim
|
local trim = vim.trim
|
||||||
local currentdir = helpers.funcs.getcwd
|
local currentdir = helpers.funcs.getcwd
|
||||||
local assert_alive = helpers.assert_alive
|
local assert_alive = helpers.assert_alive
|
||||||
local check_close = helpers.check_close
|
local check_close = helpers.check_close
|
||||||
@ -210,7 +210,7 @@ describe('fileio', function()
|
|||||||
local backup_file_name = link_file_name .. '~'
|
local backup_file_name = link_file_name .. '~'
|
||||||
|
|
||||||
write_file('Xtest_startup_file1', initial_content, false)
|
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 backup')
|
||||||
command('set backupcopy=yes')
|
command('set backupcopy=yes')
|
||||||
command('edit ' .. link_file_name)
|
command('edit ' .. link_file_name)
|
||||||
@ -233,7 +233,7 @@ describe('fileio', function()
|
|||||||
local backup_file_name = backup_dir .. sep .. link_file_name .. '~'
|
local backup_file_name = backup_dir .. sep .. link_file_name .. '~'
|
||||||
|
|
||||||
write_file('Xtest_startup_file1', initial_content, false)
|
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)
|
mkdir(backup_dir)
|
||||||
command('set backup')
|
command('set backup')
|
||||||
command('set backupcopy=yes')
|
command('set backupcopy=yes')
|
||||||
|
@ -1,29 +1,29 @@
|
|||||||
local helpers = require('test.functional.helpers')(after_each)
|
local helpers = require('test.functional.helpers')(after_each)
|
||||||
local thelpers = require('test.functional.terminal.helpers')
|
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,
|
local clear = helpers.clear
|
||||||
helpers.eq,
|
local eq = helpers.eq
|
||||||
helpers.eval,
|
local eval = helpers.eval
|
||||||
helpers.exc_exec,
|
local exc_exec = helpers.exc_exec
|
||||||
helpers.feed_command,
|
local feed_command = helpers.feed_command
|
||||||
helpers.feed,
|
local feed = helpers.feed
|
||||||
helpers.insert,
|
local insert = helpers.insert
|
||||||
helpers.neq,
|
local neq = helpers.neq
|
||||||
helpers.next_msg,
|
local next_msg = helpers.next_msg
|
||||||
helpers.nvim,
|
local nvim = helpers.nvim
|
||||||
helpers.testprg,
|
local testprg = helpers.testprg
|
||||||
helpers.ok,
|
local ok = helpers.ok
|
||||||
helpers.source,
|
local source = helpers.source
|
||||||
helpers.write_file,
|
local write_file = helpers.write_file
|
||||||
helpers.mkdir,
|
local mkdir = helpers.mkdir
|
||||||
helpers.rmdir
|
local rmdir = helpers.rmdir
|
||||||
local assert_alive = helpers.assert_alive
|
local assert_alive = helpers.assert_alive
|
||||||
local command = helpers.command
|
local command = helpers.command
|
||||||
local funcs = helpers.funcs
|
local funcs = helpers.funcs
|
||||||
local os_kill = helpers.os_kill
|
local os_kill = helpers.os_kill
|
||||||
local retry = helpers.retry
|
local retry = helpers.retry
|
||||||
local meths = helpers.meths
|
local meths = helpers.meths
|
||||||
local NIL = helpers.NIL
|
local NIL = vim.NIL
|
||||||
local poke_eventloop = helpers.poke_eventloop
|
local poke_eventloop = helpers.poke_eventloop
|
||||||
local get_pathsep = helpers.get_pathsep
|
local get_pathsep = helpers.get_pathsep
|
||||||
local pathroot = helpers.pathroot
|
local pathroot = helpers.pathroot
|
||||||
|
@ -14,7 +14,7 @@ local exec_capture = helpers.exec_capture
|
|||||||
local exec_lua = helpers.exec_lua
|
local exec_lua = helpers.exec_lua
|
||||||
local feed = helpers.feed
|
local feed = helpers.feed
|
||||||
local funcs = helpers.funcs
|
local funcs = helpers.funcs
|
||||||
local pesc = helpers.pesc
|
local pesc = vim.pesc
|
||||||
local mkdir = helpers.mkdir
|
local mkdir = helpers.mkdir
|
||||||
local mkdir_p = helpers.mkdir_p
|
local mkdir_p = helpers.mkdir_p
|
||||||
local nvim_prog = helpers.nvim_prog
|
local nvim_prog = helpers.nvim_prog
|
||||||
@ -23,15 +23,15 @@ local read_file = helpers.read_file
|
|||||||
local retry = helpers.retry
|
local retry = helpers.retry
|
||||||
local rmdir = helpers.rmdir
|
local rmdir = helpers.rmdir
|
||||||
local sleep = helpers.sleep
|
local sleep = helpers.sleep
|
||||||
local startswith = helpers.startswith
|
local startswith = vim.startswith
|
||||||
local write_file = helpers.write_file
|
local write_file = helpers.write_file
|
||||||
local meths = helpers.meths
|
local meths = helpers.meths
|
||||||
local alter_slashes = helpers.alter_slashes
|
local alter_slashes = helpers.alter_slashes
|
||||||
local is_os = helpers.is_os
|
local is_os = helpers.is_os
|
||||||
local dedent = helpers.dedent
|
local dedent = helpers.dedent
|
||||||
local tbl_map = helpers.tbl_map
|
local tbl_map = vim.tbl_map
|
||||||
local tbl_filter = helpers.tbl_filter
|
local tbl_filter = vim.tbl_filter
|
||||||
local endswith = helpers.endswith
|
local endswith = vim.endswith
|
||||||
|
|
||||||
describe('startup', function()
|
describe('startup', function()
|
||||||
it('--clean', function()
|
it('--clean', function()
|
||||||
|
@ -6,8 +6,8 @@ local insert = helpers.insert
|
|||||||
local feed = helpers.feed
|
local feed = helpers.feed
|
||||||
local expect = helpers.expect
|
local expect = helpers.expect
|
||||||
local eq = helpers.eq
|
local eq = helpers.eq
|
||||||
local map = helpers.tbl_map
|
local map = vim.tbl_map
|
||||||
local filter = helpers.tbl_filter
|
local filter = vim.tbl_filter
|
||||||
local feed_command = helpers.feed_command
|
local feed_command = helpers.feed_command
|
||||||
local command = helpers.command
|
local command = helpers.command
|
||||||
local curbuf_contents = helpers.curbuf_contents
|
local curbuf_contents = helpers.curbuf_contents
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
local helpers = require('test.functional.helpers')(after_each)
|
local helpers = require('test.functional.helpers')(after_each)
|
||||||
|
|
||||||
local eq = helpers.eq
|
local eq = helpers.eq
|
||||||
local NIL = helpers.NIL
|
local NIL = vim.NIL
|
||||||
local eval = helpers.eval
|
local eval = helpers.eval
|
||||||
local clear = helpers.clear
|
local clear = helpers.clear
|
||||||
local meths = helpers.meths
|
local meths = helpers.meths
|
||||||
|
@ -8,7 +8,7 @@ local eq = helpers.eq
|
|||||||
local neq = helpers.neq
|
local neq = helpers.neq
|
||||||
local funcs = helpers.funcs
|
local funcs = helpers.funcs
|
||||||
local matches = helpers.matches
|
local matches = helpers.matches
|
||||||
local pesc = helpers.pesc
|
local pesc = vim.pesc
|
||||||
local rmdir = helpers.rmdir
|
local rmdir = helpers.rmdir
|
||||||
local sleep = helpers.sleep
|
local sleep = helpers.sleep
|
||||||
local meths = helpers.meths
|
local meths = helpers.meths
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
local Screen = require('test.functional.ui.screen')
|
local Screen = require('test.functional.ui.screen')
|
||||||
local helpers = require('test.functional.helpers')(after_each)
|
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 eq, eval, expect, exec = helpers.eq, helpers.eval, helpers.expect, helpers.exec
|
||||||
local assert_alive = helpers.assert_alive
|
local assert_alive = helpers.assert_alive
|
||||||
local clear = helpers.clear
|
local clear = helpers.clear
|
||||||
@ -12,7 +12,7 @@ local ok = helpers.ok
|
|||||||
local rmdir = helpers.rmdir
|
local rmdir = helpers.rmdir
|
||||||
local new_argv = helpers.new_argv
|
local new_argv = helpers.new_argv
|
||||||
local new_pipename = helpers.new_pipename
|
local new_pipename = helpers.new_pipename
|
||||||
local pesc = helpers.pesc
|
local pesc = vim.pesc
|
||||||
local os_kill = helpers.os_kill
|
local os_kill = helpers.os_kill
|
||||||
local set_session = helpers.set_session
|
local set_session = helpers.set_session
|
||||||
local spawn = helpers.spawn
|
local spawn = helpers.spawn
|
||||||
@ -42,7 +42,7 @@ describe(':recover', function()
|
|||||||
end)
|
end)
|
||||||
|
|
||||||
describe("preserve and (R)ecover with custom 'directory'", function()
|
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'
|
local testfile = 'Xtest_recover_file1'
|
||||||
-- Put swapdir at the start of the 'directory' list. #1836
|
-- Put swapdir at the start of the 'directory' list. #1836
|
||||||
-- Note: `set swapfile` *must* go after `set directory`: otherwise it may
|
-- 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)
|
end)
|
||||||
|
|
||||||
describe('swapfile detection', function()
|
describe('swapfile detection', function()
|
||||||
local swapdir = luv.cwd() .. '/Xtest_swapdialog_dir'
|
local swapdir = uv.cwd() .. '/Xtest_swapdialog_dir'
|
||||||
local nvim0
|
local nvim0
|
||||||
-- Put swapdir at the start of the 'directory' list. #1836
|
-- Put swapdir at the start of the 'directory' list. #1836
|
||||||
-- Note: `set swapfile` *must* go after `set directory`: otherwise it may
|
-- 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
|
-- pretend that the swapfile was created before boot
|
||||||
local atime = os.time() - luv.uptime() - 10
|
local atime = os.time() - uv.uptime() - 10
|
||||||
luv.fs_utime(swname, atime, atime)
|
uv.fs_utime(swname, atime, atime)
|
||||||
|
|
||||||
feed(':edit Xswaptest<CR>')
|
feed(':edit Xswaptest<CR>')
|
||||||
screen:expect({
|
screen:expect({
|
||||||
@ -412,7 +412,7 @@ describe('swapfile detection', function()
|
|||||||
end)
|
end)
|
||||||
|
|
||||||
describe('quitting swapfile dialog on startup stops TUI properly', function()
|
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 testfile = 'Xtest_swapquit_file1'
|
||||||
local otherfile = 'Xtest_swapquit_file2'
|
local otherfile = 'Xtest_swapquit_file2'
|
||||||
-- Put swapdir at the start of the 'directory' list. #1836
|
-- 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 global_helpers = require('test.helpers')
|
||||||
|
|
||||||
local Session = require('test.client.session')
|
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 check_logs = global_helpers.check_logs
|
||||||
local dedent = global_helpers.dedent
|
local dedent = global_helpers.dedent
|
||||||
local eq = global_helpers.eq
|
local eq = global_helpers.eq
|
||||||
local filter = global_helpers.tbl_filter
|
|
||||||
local is_os = global_helpers.is_os
|
local is_os = global_helpers.is_os
|
||||||
local map = global_helpers.tbl_map
|
|
||||||
local ok = global_helpers.ok
|
local ok = global_helpers.ok
|
||||||
local sleep = global_helpers.sleep
|
local sleep = global_helpers.sleep
|
||||||
local tbl_contains = global_helpers.tbl_contains
|
|
||||||
local fail = global_helpers.fail
|
local fail = global_helpers.fail
|
||||||
|
|
||||||
local module = {}
|
local module = {}
|
||||||
|
|
||||||
local start_dir = luv.cwd()
|
|
||||||
local runtime_set = 'set runtimepath^=./build/lib/nvim/'
|
local runtime_set = 'set runtimepath^=./build/lib/nvim/'
|
||||||
module.nvim_prog = (os.getenv('NVIM_PRG') or global_helpers.test_build_dir .. '/bin/nvim')
|
module.nvim_prog = (os.getenv('NVIM_PRG') or global_helpers.test_build_dir .. '/bin/nvim')
|
||||||
-- Default settings for the test session.
|
-- Default settings for the test session.
|
||||||
@ -98,8 +94,8 @@ end
|
|||||||
local session, loop_running, last_error, method_error
|
local session, loop_running, last_error, method_error
|
||||||
|
|
||||||
if not is_os('win') then
|
if not is_os('win') then
|
||||||
local sigpipe_handler = luv.new_signal()
|
local sigpipe_handler = uv.new_signal()
|
||||||
luv.signal_start(sigpipe_handler, 'sigpipe', function()
|
uv.signal_start(sigpipe_handler, 'sigpipe', function()
|
||||||
print('warning: got SIGPIPE signal. Likely related to a crash in nvim')
|
print('warning: got SIGPIPE signal. Likely related to a crash in nvim')
|
||||||
end)
|
end)
|
||||||
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
|
nr_ignored = nr_ignored + 1
|
||||||
else
|
else
|
||||||
table.insert(actual_seq, msg)
|
table.insert(actual_seq, msg)
|
||||||
@ -408,11 +404,11 @@ local function remove_args(args, args_rm)
|
|||||||
end
|
end
|
||||||
local last = ''
|
local last = ''
|
||||||
for _, arg in ipairs(args) do
|
for _, arg in ipairs(args) do
|
||||||
if tbl_contains(skip_following, last) then
|
if vim.tbl_contains(skip_following, last) then
|
||||||
last = ''
|
last = ''
|
||||||
elseif tbl_contains(args_rm, arg) then
|
elseif vim.tbl_contains(args_rm, arg) then
|
||||||
last = arg
|
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".
|
table.remove(new_args) -- Remove the preceding "--cmd".
|
||||||
last = ''
|
last = ''
|
||||||
else
|
else
|
||||||
@ -426,10 +422,10 @@ function module.check_close()
|
|||||||
if not session then
|
if not session then
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
local start_time = luv.now()
|
local start_time = uv.now()
|
||||||
session:close()
|
session:close()
|
||||||
luv.update_time() -- Update cached value of luv.now() (libuv: uv_now()).
|
uv.update_time() -- Update cached value of luv.now() (libuv: uv_now()).
|
||||||
local end_time = luv.now()
|
local end_time = uv.now()
|
||||||
local delta = end_time - start_time
|
local delta = end_time - start_time
|
||||||
if delta > 500 then
|
if delta > 500 then
|
||||||
print(
|
print(
|
||||||
@ -774,7 +770,7 @@ function module.assert_visible(bufnr, visible)
|
|||||||
end
|
end
|
||||||
|
|
||||||
local function do_rmdir(path)
|
local function do_rmdir(path)
|
||||||
local stat = luv.fs_stat(path)
|
local stat = uv.fs_stat(path)
|
||||||
if stat == nil then
|
if stat == nil then
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
@ -803,12 +799,14 @@ local function do_rmdir(path)
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
local ret, err = luv.fs_rmdir(path)
|
local ret, err = uv.fs_rmdir(path)
|
||||||
if not ret then
|
if not ret then
|
||||||
error('luv.fs_rmdir(' .. path .. '): ' .. err)
|
error('luv.fs_rmdir(' .. path .. '): ' .. err)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
local start_dir = uv.cwd()
|
||||||
|
|
||||||
function module.rmdir(path)
|
function module.rmdir(path)
|
||||||
local ret, _ = pcall(do_rmdir, path)
|
local ret, _ = pcall(do_rmdir, path)
|
||||||
if not ret and is_os('win') then
|
if not ret and is_os('win') then
|
||||||
@ -959,12 +957,12 @@ end
|
|||||||
function module.parse_context(ctx)
|
function module.parse_context(ctx)
|
||||||
local parsed = {}
|
local parsed = {}
|
||||||
for _, item in ipairs({ 'regs', 'jumps', 'bufs', 'gvars' }) do
|
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'
|
return type(v) == 'table'
|
||||||
end, module.call('msgpackparse', ctx[item]))
|
end, module.call('msgpackparse', ctx[item]))
|
||||||
end
|
end
|
||||||
parsed['bufs'] = parsed['bufs'][1]
|
parsed['bufs'] = parsed['bufs'][1]
|
||||||
return map(function(v)
|
return vim.tbl_map(function(v)
|
||||||
if #v == 0 then
|
if #v == 0 then
|
||||||
return nil
|
return nil
|
||||||
end
|
end
|
||||||
@ -993,7 +991,7 @@ function module.mkdir_p(path)
|
|||||||
end
|
end
|
||||||
|
|
||||||
--- @class test.functional.helpers: test.helpers
|
--- @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 test.functional.helpers
|
||||||
return function(after_each)
|
return function(after_each)
|
||||||
|
@ -6,7 +6,7 @@ local feed = helpers.feed
|
|||||||
local feed_command = helpers.feed_command
|
local feed_command = helpers.feed_command
|
||||||
local exec = helpers.exec
|
local exec = helpers.exec
|
||||||
local meths = helpers.meths
|
local meths = helpers.meths
|
||||||
local pesc = helpers.pesc
|
local pesc = vim.pesc
|
||||||
|
|
||||||
describe('cmdline', function()
|
describe('cmdline', function()
|
||||||
before_each(clear)
|
before_each(clear)
|
||||||
|
@ -6,7 +6,7 @@ local remove_trace = helpers.remove_trace
|
|||||||
local funcs = helpers.funcs
|
local funcs = helpers.funcs
|
||||||
local clear = helpers.clear
|
local clear = helpers.clear
|
||||||
local eval = helpers.eval
|
local eval = helpers.eval
|
||||||
local NIL = helpers.NIL
|
local NIL = vim.NIL
|
||||||
local eq = helpers.eq
|
local eq = helpers.eq
|
||||||
local exec_lua = helpers.exec_lua
|
local exec_lua = helpers.exec_lua
|
||||||
local pcall_err = helpers.pcall_err
|
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 Screen = require('test.functional.ui.screen')
|
||||||
|
|
||||||
local eq = helpers.eq
|
local eq = helpers.eq
|
||||||
local NIL = helpers.NIL
|
local NIL = vim.NIL
|
||||||
local eval = helpers.eval
|
local eval = helpers.eval
|
||||||
local feed = helpers.feed
|
local feed = helpers.feed
|
||||||
local clear = helpers.clear
|
local clear = helpers.clear
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
local helpers = require('test.functional.helpers')(after_each)
|
local helpers = require('test.functional.helpers')(after_each)
|
||||||
|
|
||||||
local NIL = helpers.NIL
|
local NIL = vim.NIL
|
||||||
local command = helpers.command
|
local command = helpers.command
|
||||||
local clear = helpers.clear
|
local clear = helpers.clear
|
||||||
local exec_lua = helpers.exec_lua
|
local exec_lua = helpers.exec_lua
|
||||||
|
@ -12,7 +12,7 @@ local funcs = helpers.funcs
|
|||||||
local clear = helpers.clear
|
local clear = helpers.clear
|
||||||
local eval = helpers.eval
|
local eval = helpers.eval
|
||||||
local feed = helpers.feed
|
local feed = helpers.feed
|
||||||
local NIL = helpers.NIL
|
local NIL = vim.NIL
|
||||||
local eq = helpers.eq
|
local eq = helpers.eq
|
||||||
|
|
||||||
before_each(clear)
|
before_each(clear)
|
||||||
|
@ -3,7 +3,7 @@ local helpers = require('test.functional.helpers')(after_each)
|
|||||||
local Screen = require('test.functional.ui.screen')
|
local Screen = require('test.functional.ui.screen')
|
||||||
|
|
||||||
local eq = helpers.eq
|
local eq = helpers.eq
|
||||||
local NIL = helpers.NIL
|
local NIL = vim.NIL
|
||||||
local feed = helpers.feed
|
local feed = helpers.feed
|
||||||
local clear = helpers.clear
|
local clear = helpers.clear
|
||||||
local funcs = helpers.funcs
|
local funcs = helpers.funcs
|
||||||
|
@ -73,7 +73,7 @@ describe('vim.secure', function()
|
|||||||
|
|
||||||
local trust = helpers.read_file(funcs.stdpath('state') .. pathsep .. 'trust')
|
local trust = helpers.read_file(funcs.stdpath('state') .. pathsep .. 'trust')
|
||||||
eq(string.format('! %s', cwd .. pathsep .. 'Xfile'), vim.trim(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')
|
os.remove(funcs.stdpath('state') .. pathsep .. 'trust')
|
||||||
|
|
||||||
@ -103,7 +103,7 @@ describe('vim.secure', function()
|
|||||||
local hash = funcs.sha256(helpers.read_file('Xfile'))
|
local hash = funcs.sha256(helpers.read_file('Xfile'))
|
||||||
trust = helpers.read_file(funcs.stdpath('state') .. pathsep .. 'trust')
|
trust = helpers.read_file(funcs.stdpath('state') .. pathsep .. 'trust')
|
||||||
eq(string.format('%s %s', hash, cwd .. pathsep .. 'Xfile'), vim.trim(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')
|
os.remove(funcs.stdpath('state') .. pathsep .. 'trust')
|
||||||
|
|
||||||
|
@ -6,7 +6,7 @@ local feed = helpers.feed
|
|||||||
local eq = helpers.eq
|
local eq = helpers.eq
|
||||||
local exec_lua = helpers.exec_lua
|
local exec_lua = helpers.exec_lua
|
||||||
local next_msg = helpers.next_msg
|
local next_msg = helpers.next_msg
|
||||||
local NIL = helpers.NIL
|
local NIL = vim.NIL
|
||||||
local pcall_err = helpers.pcall_err
|
local pcall_err = helpers.pcall_err
|
||||||
|
|
||||||
describe('thread', function()
|
describe('thread', function()
|
||||||
|
@ -11,14 +11,14 @@ local insert = helpers.insert
|
|||||||
local clear = helpers.clear
|
local clear = helpers.clear
|
||||||
local eq = helpers.eq
|
local eq = helpers.eq
|
||||||
local ok = helpers.ok
|
local ok = helpers.ok
|
||||||
local pesc = helpers.pesc
|
local pesc = vim.pesc
|
||||||
local eval = helpers.eval
|
local eval = helpers.eval
|
||||||
local feed = helpers.feed
|
local feed = helpers.feed
|
||||||
local pcall_err = helpers.pcall_err
|
local pcall_err = helpers.pcall_err
|
||||||
local exec_lua = helpers.exec_lua
|
local exec_lua = helpers.exec_lua
|
||||||
local matches = helpers.matches
|
local matches = helpers.matches
|
||||||
local exec = helpers.exec
|
local exec = helpers.exec
|
||||||
local NIL = helpers.NIL
|
local NIL = vim.NIL
|
||||||
local retry = helpers.retry
|
local retry = helpers.retry
|
||||||
local next_msg = helpers.next_msg
|
local next_msg = helpers.next_msg
|
||||||
local remove_trace = helpers.remove_trace
|
local remove_trace = helpers.remove_trace
|
||||||
@ -1196,7 +1196,7 @@ describe('lua stdlib', function()
|
|||||||
end)
|
end)
|
||||||
]])
|
]])
|
||||||
|
|
||||||
helpers.poke_eventloop()
|
poke_eventloop()
|
||||||
eq('hello', exec_lua [[return vim.g.fnres]])
|
eq('hello', exec_lua [[return vim.g.fnres]])
|
||||||
end)
|
end)
|
||||||
|
|
||||||
|
@ -18,7 +18,7 @@ local neq = helpers.neq
|
|||||||
local mkdir = helpers.mkdir
|
local mkdir = helpers.mkdir
|
||||||
local rmdir = helpers.rmdir
|
local rmdir = helpers.rmdir
|
||||||
local alter_slashes = helpers.alter_slashes
|
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 expect_exit = helpers.expect_exit
|
||||||
local is_os = helpers.is_os
|
local is_os = helpers.is_os
|
||||||
|
|
||||||
|
@ -4,7 +4,7 @@ local clear = helpers.clear
|
|||||||
local exec_lua = helpers.exec_lua
|
local exec_lua = helpers.exec_lua
|
||||||
local run = helpers.run
|
local run = helpers.run
|
||||||
local stop = helpers.stop
|
local stop = helpers.stop
|
||||||
local NIL = helpers.NIL
|
local NIL = vim.NIL
|
||||||
|
|
||||||
local M = {}
|
local M = {}
|
||||||
|
|
||||||
|
@ -11,12 +11,12 @@ local eq = helpers.eq
|
|||||||
local eval = helpers.eval
|
local eval = helpers.eval
|
||||||
local matches = helpers.matches
|
local matches = helpers.matches
|
||||||
local pcall_err = helpers.pcall_err
|
local pcall_err = helpers.pcall_err
|
||||||
local pesc = helpers.pesc
|
local pesc = vim.pesc
|
||||||
local insert = helpers.insert
|
local insert = helpers.insert
|
||||||
local funcs = helpers.funcs
|
local funcs = helpers.funcs
|
||||||
local retry = helpers.retry
|
local retry = helpers.retry
|
||||||
local stop = helpers.stop
|
local stop = helpers.stop
|
||||||
local NIL = helpers.NIL
|
local NIL = vim.NIL
|
||||||
local read_file = require('test.helpers').read_file
|
local read_file = require('test.helpers').read_file
|
||||||
local write_file = require('test.helpers').write_file
|
local write_file = require('test.helpers').write_file
|
||||||
local is_ci = helpers.is_ci
|
local is_ci = helpers.is_ci
|
||||||
@ -24,6 +24,7 @@ local meths = helpers.meths
|
|||||||
local is_os = helpers.is_os
|
local is_os = helpers.is_os
|
||||||
local skip = helpers.skip
|
local skip = helpers.skip
|
||||||
local mkdir = helpers.mkdir
|
local mkdir = helpers.mkdir
|
||||||
|
local tmpname = helpers.tmpname
|
||||||
|
|
||||||
local clear_notrace = lsp_helpers.clear_notrace
|
local clear_notrace = lsp_helpers.clear_notrace
|
||||||
local create_server_definition = lsp_helpers.create_server_definition
|
local create_server_definition = lsp_helpers.create_server_definition
|
||||||
@ -728,8 +729,8 @@ describe('LSP', function()
|
|||||||
on_handler = function(err, result, ctx)
|
on_handler = function(err, result, ctx)
|
||||||
eq(table.remove(expected_handlers), { err, result, ctx }, 'expected handler')
|
eq(table.remove(expected_handlers), { err, result, ctx }, 'expected handler')
|
||||||
if ctx.method == 'start' then
|
if ctx.method == 'start' then
|
||||||
local tmpfile_old = helpers.tmpname()
|
local tmpfile_old = tmpname()
|
||||||
local tmpfile_new = helpers.tmpname()
|
local tmpfile_new = tmpname()
|
||||||
os.remove(tmpfile_new)
|
os.remove(tmpfile_new)
|
||||||
exec_lua(
|
exec_lua(
|
||||||
[=[
|
[=[
|
||||||
@ -2278,7 +2279,7 @@ describe('LSP', function()
|
|||||||
)
|
)
|
||||||
end)
|
end)
|
||||||
it('Supports file creation with CreateFile payload', function()
|
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
|
os.remove(tmpfile) -- Should not exist, only interested in a tmpname
|
||||||
local uri = exec_lua('return vim.uri_from_fname(...)', tmpfile)
|
local uri = exec_lua('return vim.uri_from_fname(...)', tmpfile)
|
||||||
local edit = {
|
local edit = {
|
||||||
@ -2295,7 +2296,7 @@ describe('LSP', function()
|
|||||||
it(
|
it(
|
||||||
'Supports file creation in folder that needs to be created with CreateFile payload',
|
'Supports file creation in folder that needs to be created with CreateFile payload',
|
||||||
function()
|
function()
|
||||||
local tmpfile = helpers.tmpname()
|
local tmpfile = tmpname()
|
||||||
os.remove(tmpfile) -- Should not exist, only interested in a tmpname
|
os.remove(tmpfile) -- Should not exist, only interested in a tmpname
|
||||||
tmpfile = tmpfile .. '/dummy/x/'
|
tmpfile = tmpfile .. '/dummy/x/'
|
||||||
local uri = exec_lua('return vim.uri_from_fname(...)', tmpfile)
|
local uri = exec_lua('return vim.uri_from_fname(...)', tmpfile)
|
||||||
@ -2312,7 +2313,7 @@ describe('LSP', function()
|
|||||||
end
|
end
|
||||||
)
|
)
|
||||||
it('createFile does not touch file if it exists and ignoreIfExists is set', function()
|
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')
|
write_file(tmpfile, 'Dummy content')
|
||||||
local uri = exec_lua('return vim.uri_from_fname(...)', tmpfile)
|
local uri = exec_lua('return vim.uri_from_fname(...)', tmpfile)
|
||||||
local edit = {
|
local edit = {
|
||||||
@ -2331,7 +2332,7 @@ describe('LSP', function()
|
|||||||
eq('Dummy content', read_file(tmpfile))
|
eq('Dummy content', read_file(tmpfile))
|
||||||
end)
|
end)
|
||||||
it('createFile overrides file if overwrite is set', function()
|
it('createFile overrides file if overwrite is set', function()
|
||||||
local tmpfile = helpers.tmpname()
|
local tmpfile = tmpname()
|
||||||
write_file(tmpfile, 'Dummy content')
|
write_file(tmpfile, 'Dummy content')
|
||||||
local uri = exec_lua('return vim.uri_from_fname(...)', tmpfile)
|
local uri = exec_lua('return vim.uri_from_fname(...)', tmpfile)
|
||||||
local edit = {
|
local edit = {
|
||||||
@ -2351,7 +2352,7 @@ describe('LSP', function()
|
|||||||
eq('', read_file(tmpfile))
|
eq('', read_file(tmpfile))
|
||||||
end)
|
end)
|
||||||
it('DeleteFile delete file and buffer', function()
|
it('DeleteFile delete file and buffer', function()
|
||||||
local tmpfile = helpers.tmpname()
|
local tmpfile = tmpname()
|
||||||
write_file(tmpfile, 'Be gone')
|
write_file(tmpfile, 'Be gone')
|
||||||
local uri = exec_lua(
|
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))
|
eq(false, exec_lua('return vim.api.nvim_buf_is_loaded(vim.fn.bufadd(...))', tmpfile))
|
||||||
end)
|
end)
|
||||||
it('DeleteFile fails if file does not exist and ignoreIfNotExists is false', function()
|
it('DeleteFile fails if file does not exist and ignoreIfNotExists is false', function()
|
||||||
local tmpfile = helpers.tmpname()
|
local tmpfile = tmpname()
|
||||||
os.remove(tmpfile)
|
os.remove(tmpfile)
|
||||||
local uri = exec_lua('return vim.uri_from_fname(...)', tmpfile)
|
local uri = exec_lua('return vim.uri_from_fname(...)', tmpfile)
|
||||||
local edit = {
|
local edit = {
|
||||||
@ -2398,9 +2399,9 @@ describe('LSP', function()
|
|||||||
local pathsep = helpers.get_pathsep()
|
local pathsep = helpers.get_pathsep()
|
||||||
|
|
||||||
it('Can rename an existing file', function()
|
it('Can rename an existing file', function()
|
||||||
local old = helpers.tmpname()
|
local old = tmpname()
|
||||||
write_file(old, 'Test content')
|
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
|
os.remove(new) -- only reserve the name, file must not exist for the test scenario
|
||||||
local lines = exec_lua(
|
local lines = exec_lua(
|
||||||
[[
|
[[
|
||||||
@ -2424,9 +2425,9 @@ describe('LSP', function()
|
|||||||
os.remove(new)
|
os.remove(new)
|
||||||
end)
|
end)
|
||||||
it('Kills old buffer after renaming an existing file', function()
|
it('Kills old buffer after renaming an existing file', function()
|
||||||
local old = helpers.tmpname()
|
local old = tmpname()
|
||||||
write_file(old, 'Test content')
|
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
|
os.remove(new) -- only reserve the name, file must not exist for the test scenario
|
||||||
local lines = exec_lua(
|
local lines = exec_lua(
|
||||||
[[
|
[[
|
||||||
@ -2444,8 +2445,8 @@ describe('LSP', function()
|
|||||||
end)
|
end)
|
||||||
it('Can rename a directory', function()
|
it('Can rename a directory', function()
|
||||||
-- only reserve the name, file must not exist for the test scenario
|
-- only reserve the name, file must not exist for the test scenario
|
||||||
local old_dir = helpers.tmpname()
|
local old_dir = tmpname()
|
||||||
local new_dir = helpers.tmpname()
|
local new_dir = tmpname()
|
||||||
os.remove(old_dir)
|
os.remove(old_dir)
|
||||||
os.remove(new_dir)
|
os.remove(new_dir)
|
||||||
|
|
||||||
@ -2479,9 +2480,9 @@ describe('LSP', function()
|
|||||||
it(
|
it(
|
||||||
'Does not rename file if target exists and ignoreIfExists is set or overwrite is false',
|
'Does not rename file if target exists and ignoreIfExists is set or overwrite is false',
|
||||||
function()
|
function()
|
||||||
local old = helpers.tmpname()
|
local old = tmpname()
|
||||||
write_file(old, 'Old File')
|
write_file(old, 'Old File')
|
||||||
local new = helpers.tmpname()
|
local new = tmpname()
|
||||||
write_file(new, 'New file')
|
write_file(new, 'New file')
|
||||||
|
|
||||||
exec_lua(
|
exec_lua(
|
||||||
@ -2514,9 +2515,9 @@ describe('LSP', function()
|
|||||||
end
|
end
|
||||||
)
|
)
|
||||||
it('Does override target if overwrite is true', function()
|
it('Does override target if overwrite is true', function()
|
||||||
local old = helpers.tmpname()
|
local old = tmpname()
|
||||||
write_file(old, 'Old file')
|
write_file(old, 'Old file')
|
||||||
local new = helpers.tmpname()
|
local new = tmpname()
|
||||||
write_file(new, 'New file')
|
write_file(new, 'New file')
|
||||||
exec_lua(
|
exec_lua(
|
||||||
[[
|
[[
|
||||||
@ -4043,7 +4044,7 @@ describe('LSP', function()
|
|||||||
if is_os('win') then
|
if is_os('win') then
|
||||||
tmpfile = '\\\\.\\\\pipe\\pipe.test'
|
tmpfile = '\\\\.\\\\pipe\\pipe.test'
|
||||||
else
|
else
|
||||||
tmpfile = helpers.tmpname()
|
tmpfile = tmpname()
|
||||||
os.remove(tmpfile)
|
os.remove(tmpfile)
|
||||||
end
|
end
|
||||||
local result = exec_lua(
|
local result = exec_lua(
|
||||||
@ -4150,7 +4151,7 @@ describe('LSP', function()
|
|||||||
describe('#dynamic vim.lsp._dynamic', function()
|
describe('#dynamic vim.lsp._dynamic', function()
|
||||||
it('supports dynamic registration', function()
|
it('supports dynamic registration', function()
|
||||||
---@type string
|
---@type string
|
||||||
local root_dir = helpers.tmpname()
|
local root_dir = tmpname()
|
||||||
os.remove(root_dir)
|
os.remove(root_dir)
|
||||||
mkdir(root_dir)
|
mkdir(root_dir)
|
||||||
local tmpfile = root_dir .. '/dynamic.foo'
|
local tmpfile = root_dir .. '/dynamic.foo'
|
||||||
@ -4261,7 +4262,7 @@ describe('LSP', function()
|
|||||||
describe('vim.lsp._watchfiles', function()
|
describe('vim.lsp._watchfiles', function()
|
||||||
it('sends notifications when files change', function()
|
it('sends notifications when files change', function()
|
||||||
skip(is_os('bsd'), 'bsd only reports rename on folders if file inside change')
|
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)
|
os.remove(root_dir)
|
||||||
mkdir(root_dir)
|
mkdir(root_dir)
|
||||||
|
|
||||||
|
@ -9,7 +9,7 @@ local matches = helpers.matches
|
|||||||
local write_file = helpers.write_file
|
local write_file = helpers.write_file
|
||||||
local tmpname = helpers.tmpname
|
local tmpname = helpers.tmpname
|
||||||
local eq = helpers.eq
|
local eq = helpers.eq
|
||||||
local pesc = helpers.pesc
|
local pesc = vim.pesc
|
||||||
local skip = helpers.skip
|
local skip = helpers.skip
|
||||||
local is_ci = helpers.is_ci
|
local is_ci = helpers.is_ci
|
||||||
|
|
||||||
|
@ -1,10 +1,12 @@
|
|||||||
local helpers = require('test.functional.helpers')(after_each)
|
local helpers = require('test.functional.helpers')(after_each)
|
||||||
local clear = helpers.clear
|
local clear = helpers.clear
|
||||||
local meths = helpers.meths
|
local meths = helpers.meths
|
||||||
local eq, nvim_eval, nvim_command, exc_exec =
|
local eq = helpers.eq
|
||||||
helpers.eq, helpers.eval, helpers.command, helpers.exc_exec
|
local nvim_eval = helpers.eval
|
||||||
|
local nvim_command = helpers.command
|
||||||
|
local exc_exec = helpers.exc_exec
|
||||||
local ok = helpers.ok
|
local ok = helpers.ok
|
||||||
local NIL = helpers.NIL
|
local NIL = vim.NIL
|
||||||
|
|
||||||
describe('autoload/msgpack.vim', function()
|
describe('autoload/msgpack.vim', function()
|
||||||
before_each(function()
|
before_each(function()
|
||||||
|
@ -116,7 +116,7 @@ describe('rubyeval()', function()
|
|||||||
end)
|
end)
|
||||||
|
|
||||||
it('returns nil for empty strings', function()
|
it('returns nil for empty strings', function()
|
||||||
eq(helpers.NIL, funcs.rubyeval(''))
|
eq(vim.NIL, funcs.rubyeval(''))
|
||||||
end)
|
end)
|
||||||
|
|
||||||
it('errors out when given non-string', function()
|
it('errors out when given non-string', function()
|
||||||
|
@ -10,7 +10,7 @@ local meths = helpers.meths
|
|||||||
local clear = helpers.clear
|
local clear = helpers.clear
|
||||||
local eq = helpers.eq
|
local eq = helpers.eq
|
||||||
local matches = helpers.matches
|
local matches = helpers.matches
|
||||||
local pesc = helpers.pesc
|
local pesc = vim.pesc
|
||||||
|
|
||||||
describe(':edit term://*', function()
|
describe(':edit term://*', function()
|
||||||
local get_screen = function(columns, lines)
|
local get_screen = function(columns, lines)
|
||||||
|
@ -1,6 +1,5 @@
|
|||||||
local helpers = require('test.functional.helpers')(after_each)
|
local helpers = require('test.functional.helpers')(after_each)
|
||||||
local Screen = require('test.functional.ui.screen')
|
local Screen = require('test.functional.ui.screen')
|
||||||
local global_helpers = require('test.helpers')
|
|
||||||
local os = require('os')
|
local os = require('os')
|
||||||
local clear, feed = helpers.clear, helpers.feed
|
local clear, feed = helpers.clear, helpers.feed
|
||||||
local assert_alive = helpers.assert_alive
|
local assert_alive = helpers.assert_alive
|
||||||
@ -17,9 +16,9 @@ local curbufmeths = helpers.curbufmeths
|
|||||||
local funcs = helpers.funcs
|
local funcs = helpers.funcs
|
||||||
local run = helpers.run
|
local run = helpers.run
|
||||||
local pcall_err = helpers.pcall_err
|
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 curbuf, curwin, curtab = helpers.curbuf, helpers.curwin, helpers.curtab
|
||||||
local NIL = helpers.NIL
|
local NIL = vim.NIL
|
||||||
|
|
||||||
describe('float window', function()
|
describe('float window', function()
|
||||||
before_each(function()
|
before_each(function()
|
||||||
|
@ -7,7 +7,7 @@ local feed_command = helpers.feed_command
|
|||||||
local insert = helpers.insert
|
local insert = helpers.insert
|
||||||
local funcs = helpers.funcs
|
local funcs = helpers.funcs
|
||||||
local meths = helpers.meths
|
local meths = helpers.meths
|
||||||
local split = helpers.split
|
local split = vim.split
|
||||||
local dedent = helpers.dedent
|
local dedent = helpers.dedent
|
||||||
|
|
||||||
describe('multibyte rendering', function()
|
describe('multibyte rendering', function()
|
||||||
|
@ -72,10 +72,10 @@
|
|||||||
|
|
||||||
local helpers = require('test.functional.helpers')(nil)
|
local helpers = require('test.functional.helpers')(nil)
|
||||||
local busted = require('busted')
|
local busted = require('busted')
|
||||||
local deepcopy = helpers.deepcopy
|
local deepcopy = vim.deepcopy
|
||||||
local shallowcopy = helpers.shallowcopy
|
local shallowcopy = helpers.shallowcopy
|
||||||
local concat_tables = helpers.concat_tables
|
local concat_tables = helpers.concat_tables
|
||||||
local pesc = helpers.pesc
|
local pesc = vim.pesc
|
||||||
local run_session = helpers.run_session
|
local run_session = helpers.run_session
|
||||||
local eq = helpers.eq
|
local eq = helpers.eq
|
||||||
local dedent = helpers.dedent
|
local dedent = helpers.dedent
|
||||||
|
@ -6,12 +6,12 @@ local command = helpers.command
|
|||||||
local eq = helpers.eq
|
local eq = helpers.eq
|
||||||
local eval = helpers.eval
|
local eval = helpers.eval
|
||||||
local feed = helpers.feed
|
local feed = helpers.feed
|
||||||
local map = helpers.tbl_map
|
local map = vim.tbl_map
|
||||||
local nvim = helpers.nvim
|
local nvim = helpers.nvim
|
||||||
local parse_context = helpers.parse_context
|
local parse_context = helpers.parse_context
|
||||||
local exec_capture = helpers.exec_capture
|
local exec_capture = helpers.exec_capture
|
||||||
local source = helpers.source
|
local source = helpers.source
|
||||||
local trim = helpers.trim
|
local trim = vim.trim
|
||||||
local write_file = helpers.write_file
|
local write_file = helpers.write_file
|
||||||
local pcall_err = helpers.pcall_err
|
local pcall_err = helpers.pcall_err
|
||||||
|
|
||||||
|
@ -10,7 +10,7 @@ local command = helpers.command
|
|||||||
local exc_exec = helpers.exc_exec
|
local exc_exec = helpers.exc_exec
|
||||||
local pcall_err = helpers.pcall_err
|
local pcall_err = helpers.pcall_err
|
||||||
local async_meths = helpers.async_meths
|
local async_meths = helpers.async_meths
|
||||||
local NIL = helpers.NIL
|
local NIL = vim.NIL
|
||||||
|
|
||||||
local screen
|
local screen
|
||||||
|
|
||||||
|
@ -7,7 +7,7 @@ local eval = helpers.eval
|
|||||||
local command = helpers.command
|
local command = helpers.command
|
||||||
local exc_exec = helpers.exc_exec
|
local exc_exec = helpers.exc_exec
|
||||||
local pcall_err = helpers.pcall_err
|
local pcall_err = helpers.pcall_err
|
||||||
local NIL = helpers.NIL
|
local NIL = vim.NIL
|
||||||
local source = helpers.source
|
local source = helpers.source
|
||||||
|
|
||||||
describe('json_decode() function', function()
|
describe('json_decode() function', function()
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
local helpers = require('test.functional.helpers')(after_each)
|
local helpers = require('test.functional.helpers')(after_each)
|
||||||
local clear, eq, neq = helpers.clear, helpers.eq, helpers.neq
|
local clear, eq, neq = helpers.clear, helpers.eq, helpers.neq
|
||||||
local command, meths, funcs = helpers.command, helpers.meths, helpers.funcs
|
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
|
-- Set up two overlapping floating windows
|
||||||
local setup_floating_windows = function()
|
local setup_floating_windows = function()
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
local helpers = require('test.functional.helpers')(after_each)
|
local helpers = require('test.functional.helpers')(after_each)
|
||||||
|
|
||||||
local eq = helpers.eq
|
local eq = helpers.eq
|
||||||
local NIL = helpers.NIL
|
local NIL = vim.NIL
|
||||||
local eval = helpers.eval
|
local eval = helpers.eval
|
||||||
local clear = helpers.clear
|
local clear = helpers.clear
|
||||||
local meths = helpers.meths
|
local meths = helpers.meths
|
||||||
|
@ -6,7 +6,7 @@ local clear = helpers.clear
|
|||||||
local eval = helpers.eval
|
local eval = helpers.eval
|
||||||
local eq = helpers.eq
|
local eq = helpers.eq
|
||||||
local meths = helpers.meths
|
local meths = helpers.meths
|
||||||
local NIL = helpers.NIL
|
local NIL = vim.NIL
|
||||||
|
|
||||||
describe('Special values', function()
|
describe('Special values', function()
|
||||||
before_each(clear)
|
before_each(clear)
|
||||||
|
@ -7,7 +7,7 @@ local eval = helpers.eval
|
|||||||
local exc_exec = helpers.exc_exec
|
local exc_exec = helpers.exc_exec
|
||||||
local pcall_err = helpers.pcall_err
|
local pcall_err = helpers.pcall_err
|
||||||
local funcs = helpers.funcs
|
local funcs = helpers.funcs
|
||||||
local NIL = helpers.NIL
|
local NIL = vim.NIL
|
||||||
local source = helpers.source
|
local source = helpers.source
|
||||||
|
|
||||||
describe('string() function', function()
|
describe('string() function', function()
|
||||||
|
@ -1,4 +1,3 @@
|
|||||||
local shared = vim
|
|
||||||
local luaassert = require('luassert')
|
local luaassert = require('luassert')
|
||||||
local busted = require('busted')
|
local busted = require('busted')
|
||||||
local luv = require('luv')
|
local luv = require('luv')
|
||||||
@ -954,6 +953,6 @@ function module.mkdir(path)
|
|||||||
return luv.fs_mkdir(path, 493)
|
return luv.fs_mkdir(path, 493)
|
||||||
end
|
end
|
||||||
|
|
||||||
module = shared.tbl_extend('error', module, Paths, shared, require('test.deprecated'))
|
module = vim.tbl_extend('error', module, Paths, require('test.deprecated'))
|
||||||
|
|
||||||
return module
|
return module
|
||||||
|
@ -14,7 +14,7 @@ local cimport = helpers.cimport
|
|||||||
local to_cstr = helpers.to_cstr
|
local to_cstr = helpers.to_cstr
|
||||||
local alloc_log_new = helpers.alloc_log_new
|
local alloc_log_new = helpers.alloc_log_new
|
||||||
local concat_tables = helpers.concat_tables
|
local concat_tables = helpers.concat_tables
|
||||||
local map = helpers.tbl_map
|
local map = vim.tbl_map
|
||||||
|
|
||||||
local a = eval_helpers.alloc_logging_helpers
|
local a = eval_helpers.alloc_logging_helpers
|
||||||
local int = eval_helpers.int
|
local int = eval_helpers.int
|
||||||
|
@ -10,9 +10,9 @@ local say = require('say')
|
|||||||
local check_cores = global_helpers.check_cores
|
local check_cores = global_helpers.check_cores
|
||||||
local dedent = global_helpers.dedent
|
local dedent = global_helpers.dedent
|
||||||
local neq = global_helpers.neq
|
local neq = global_helpers.neq
|
||||||
local map = global_helpers.tbl_map
|
local map = vim.tbl_map
|
||||||
local eq = global_helpers.eq
|
local eq = global_helpers.eq
|
||||||
local trim = global_helpers.trim
|
local trim = vim.trim
|
||||||
|
|
||||||
-- add some standard header locations
|
-- add some standard header locations
|
||||||
for _, p in ipairs(Paths.include_paths) do
|
for _, p in ipairs(Paths.include_paths) do
|
||||||
@ -904,7 +904,7 @@ local module = {
|
|||||||
is_asan = is_asan,
|
is_asan = is_asan,
|
||||||
}
|
}
|
||||||
--- @class test.unit.helpers: test.unit.helpers.module, test.helpers
|
--- @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 function()
|
||||||
return module
|
return module
|
||||||
|
@ -17,7 +17,7 @@ local OK = helpers.OK
|
|||||||
local FAIL = helpers.FAIL
|
local FAIL = helpers.FAIL
|
||||||
local NULL = helpers.NULL
|
local NULL = helpers.NULL
|
||||||
local mkdir = helpers.mkdir
|
local mkdir = helpers.mkdir
|
||||||
local endswith = helpers.endswith
|
local endswith = vim.endswith
|
||||||
|
|
||||||
local NODE_NORMAL = 0
|
local NODE_NORMAL = 0
|
||||||
local NODE_WRITABLE = 1
|
local NODE_WRITABLE = 1
|
||||||
|
Loading…
Reference in New Issue
Block a user