aboutsummaryrefslogtreecommitdiff
path: root/test/functional/core
diff options
context:
space:
mode:
Diffstat (limited to 'test/functional/core')
-rw-r--r--test/functional/core/channels_spec.lua28
-rw-r--r--test/functional/core/exit_spec.lua6
-rw-r--r--test/functional/core/fileio_spec.lua62
-rw-r--r--test/functional/core/job_spec.lua46
-rw-r--r--test/functional/core/main_spec.lua20
-rw-r--r--test/functional/core/path_spec.lua4
-rw-r--r--test/functional/core/remote_spec.lua22
-rw-r--r--test/functional/core/spellfile_spec.lua22
-rw-r--r--test/functional/core/startup_spec.lua102
9 files changed, 156 insertions, 156 deletions
diff --git a/test/functional/core/channels_spec.lua b/test/functional/core/channels_spec.lua
index 566b8e4250..ce13c4755d 100644
--- a/test/functional/core/channels_spec.lua
+++ b/test/functional/core/channels_spec.lua
@@ -1,7 +1,7 @@
local helpers = require('test.functional.helpers')(after_each)
local clear, eq, eval, next_msg, ok, source =
helpers.clear, helpers.eq, helpers.eval, helpers.next_msg, helpers.ok, helpers.source
-local command, funcs, meths = helpers.command, helpers.funcs, helpers.meths
+local command, fn, api = helpers.command, helpers.fn, helpers.api
local sleep = vim.uv.sleep
local spawn, nvim_argv = helpers.spawn, helpers.nvim_argv
local set_session = helpers.set_session
@@ -33,12 +33,12 @@ describe('channels', function()
pending('can connect to socket', function()
local server = spawn(nvim_argv, nil, nil, true)
set_session(server)
- local address = funcs.serverlist()[1]
+ local address = fn.serverlist()[1]
local client = spawn(nvim_argv, nil, nil, true)
set_session(client)
source(init)
- meths.nvim_set_var('address', address)
+ api.nvim_set_var('address', address)
command("let g:id = sockconnect('pipe', address, {'on_data':'OnEvent'})")
local id = eval('g:id')
ok(id > 0)
@@ -46,7 +46,7 @@ describe('channels', function()
command("call chansend(g:id, msgpackdump([[2,'nvim_set_var',['code',23]]]))")
set_session(server)
retry(nil, 1000, function()
- eq(23, meths.nvim_get_var('code'))
+ eq(23, api.nvim_get_var('code'))
end)
set_session(client)
@@ -67,8 +67,8 @@ describe('channels', function()
\ 'on_exit': function('OnEvent'),
\ }
]])
- meths.nvim_set_var('nvim_prog', nvim_prog)
- meths.nvim_set_var(
+ api.nvim_set_var('nvim_prog', nvim_prog)
+ api.nvim_set_var(
'code',
[[
function! OnEvent(id, data, event) dict
@@ -117,8 +117,8 @@ describe('channels', function()
\ 'on_exit': function('OnEvent'),
\ }
]])
- meths.nvim_set_var('nvim_prog', nvim_prog)
- meths.nvim_set_var(
+ api.nvim_set_var('nvim_prog', nvim_prog)
+ api.nvim_set_var(
'code',
[[
function! OnStdin(id, data, event) dict
@@ -165,8 +165,8 @@ describe('channels', function()
\ 'pty': v:true,
\ }
]])
- meths.nvim_set_var('nvim_prog', nvim_prog)
- meths.nvim_set_var(
+ api.nvim_set_var('nvim_prog', nvim_prog)
+ api.nvim_set_var(
'code',
[[
function! OnEvent(id, data, event) dict
@@ -220,8 +220,8 @@ describe('channels', function()
\ 'rpc': v:true,
\ }
]])
- meths.nvim_set_var('nvim_prog', nvim_prog)
- meths.nvim_set_var(
+ api.nvim_set_var('nvim_prog', nvim_prog)
+ api.nvim_set_var(
'code',
[[
let id = stdioopen({'rpc':v:true})
@@ -250,7 +250,7 @@ describe('channels', function()
end)
it('can use buffered output mode', function()
- skip(funcs.executable('grep') == 0, 'missing "grep" command')
+ skip(fn.executable('grep') == 0, 'missing "grep" command')
source([[
let g:job_opts = {
\ 'on_stdout': function('OnEvent'),
@@ -285,7 +285,7 @@ describe('channels', function()
end)
it('can use buffered output mode with no stream callback', function()
- skip(funcs.executable('grep') == 0, 'missing "grep" command')
+ skip(fn.executable('grep') == 0, 'missing "grep" command')
source([[
function! OnEvent(id, data, event) dict
call rpcnotify(1, a:event, a:id, a:data, self.stdout)
diff --git a/test/functional/core/exit_spec.lua b/test/functional/core/exit_spec.lua
index 9ae2150f84..b74ebb2367 100644
--- a/test/functional/core/exit_spec.lua
+++ b/test/functional/core/exit_spec.lua
@@ -7,7 +7,7 @@ local feed = helpers.feed
local eval = helpers.eval
local eq = helpers.eq
local run = helpers.run
-local funcs = helpers.funcs
+local fn = helpers.fn
local nvim_prog = helpers.nvim_prog
local pcall_err = helpers.pcall_err
local exec_capture = helpers.exec_capture
@@ -18,7 +18,7 @@ describe('v:exiting', function()
before_each(function()
helpers.clear()
- cid = helpers.meths.nvim_get_api_info()[1]
+ cid = helpers.api.nvim_get_api_info()[1]
end)
it('defaults to v:null', function()
@@ -68,7 +68,7 @@ describe(':cquit', function()
poke_eventloop()
assert_alive()
else
- funcs.system({ nvim_prog, '-u', 'NONE', '-i', 'NONE', '--headless', '--cmd', cmdline })
+ fn.system({ nvim_prog, '-u', 'NONE', '-i', 'NONE', '--headless', '--cmd', cmdline })
eq(exit_code, eval('v:shell_error'))
end
end
diff --git a/test/functional/core/fileio_spec.lua b/test/functional/core/fileio_spec.lua
index 229d127b6d..928cab525c 100644
--- a/test/functional/core/fileio_spec.lua
+++ b/test/functional/core/fileio_spec.lua
@@ -9,18 +9,18 @@ local eq = helpers.eq
local neq = helpers.neq
local ok = helpers.ok
local feed = helpers.feed
-local funcs = helpers.funcs
+local fn = helpers.fn
local nvim_prog = helpers.nvim_prog
local request = helpers.request
local retry = helpers.retry
local rmdir = helpers.rmdir
local matches = helpers.matches
-local meths = helpers.meths
+local api = helpers.api
local mkdir = helpers.mkdir
local sleep = vim.uv.sleep
local read_file = helpers.read_file
local trim = vim.trim
-local currentdir = helpers.funcs.getcwd
+local currentdir = helpers.fn.getcwd
local assert_alive = helpers.assert_alive
local check_close = helpers.check_close
local expect_exit = helpers.expect_exit
@@ -100,8 +100,8 @@ describe('fileio', function()
eq('foozubbaz', trim(read_file('Xtest_startup_file1')))
-- 4. Exit caused by deadly signal (+ 'swapfile').
- local j = funcs.jobstart(vim.tbl_flatten({ args, '--embed' }), { rpc = true })
- funcs.rpcrequest(
+ local j = fn.jobstart(vim.tbl_flatten({ args, '--embed' }), { rpc = true })
+ fn.rpcrequest(
j,
'nvim_exec2',
[[
@@ -112,8 +112,8 @@ describe('fileio', function()
]],
{}
)
- eq('Xtest_startup_swapdir', funcs.rpcrequest(j, 'nvim_eval', '&directory'))
- funcs.jobstop(j) -- Send deadly signal.
+ eq('Xtest_startup_swapdir', fn.rpcrequest(j, 'nvim_eval', '&directory'))
+ fn.jobstop(j) -- Send deadly signal.
local screen = startup()
feed(':recover Xtest_startup_file2<cr>')
@@ -258,9 +258,9 @@ describe('fileio', function()
'',
}
local fname = 'Xtest_тест.md'
- funcs.writefile(text, fname, 's')
+ fn.writefile(text, fname, 's')
table.insert(text, '')
- eq(text, funcs.readfile(fname, 'b'))
+ eq(text, fn.readfile(fname, 'b'))
end)
it("read invalid u8 over INT_MAX doesn't segfault", function()
clear()
@@ -341,7 +341,7 @@ describe('tmpdir', function()
-- Tempfiles typically look like: "…/nvim.<user>/xxx/0".
-- - "…/nvim.<user>/xxx/" is the per-process tmpdir, not shared with other Nvims.
-- - "…/nvim.<user>/" is the tmpdir root, shared by all Nvims (normally).
- local tmproot = (funcs.tempname()):match(tmproot_pat)
+ local tmproot = (fn.tempname()):match(tmproot_pat)
ok(tmproot:len() > 4, 'tmproot like "nvim.foo"', tmproot)
return tmproot
end
@@ -360,7 +360,7 @@ describe('tmpdir', function()
rmdir(tmproot)
write_file(tmproot, '') -- Not a directory, vim_mktempdir() should skip it.
clear({ env = { NVIM_LOG_FILE = testlog, TMPDIR = os_tmpdir } })
- matches(tmproot_pat, funcs.stdpath('run')) -- Tickle vim_mktempdir().
+ matches(tmproot_pat, fn.stdpath('run')) -- Tickle vim_mktempdir().
-- Assert that broken tmpdir root was handled.
assert_log('tempdir root not a directory', testlog, 100)
@@ -369,9 +369,9 @@ describe('tmpdir', function()
os.remove(testlog)
os.remove(tmproot)
mkdir(tmproot)
- funcs.setfperm(tmproot, 'rwxr--r--') -- Invalid permissions, vim_mktempdir() should skip it.
+ fn.setfperm(tmproot, 'rwxr--r--') -- Invalid permissions, vim_mktempdir() should skip it.
clear({ env = { NVIM_LOG_FILE = testlog, TMPDIR = os_tmpdir } })
- matches(tmproot_pat, funcs.stdpath('run')) -- Tickle vim_mktempdir().
+ matches(tmproot_pat, fn.stdpath('run')) -- Tickle vim_mktempdir().
-- Assert that broken tmpdir root was handled.
assert_log('tempdir root has invalid permissions', testlog, 100)
end)
@@ -380,8 +380,8 @@ describe('tmpdir', function()
local bigname = ('%s/%s'):format(os_tmpdir, ('x'):rep(666))
mkdir(bigname)
clear({ env = { NVIM_LOG_FILE = testlog, TMPDIR = bigname } })
- matches(tmproot_pat, funcs.stdpath('run')) -- Tickle vim_mktempdir().
- local len = (funcs.tempname()):len()
+ matches(tmproot_pat, fn.stdpath('run')) -- Tickle vim_mktempdir().
+ local len = (fn.tempname()):len()
ok(len > 4 and len < 256, '4 < len < 256', tostring(len))
end)
@@ -390,33 +390,33 @@ describe('tmpdir', function()
assert_nolog('tempdir disappeared', testlog)
local function rm_tmpdir()
- local tmpname1 = funcs.tempname()
- local tmpdir1 = funcs.fnamemodify(tmpname1, ':h')
- eq(funcs.stdpath('run'), tmpdir1)
+ local tmpname1 = fn.tempname()
+ local tmpdir1 = fn.fnamemodify(tmpname1, ':h')
+ eq(fn.stdpath('run'), tmpdir1)
rmdir(tmpdir1)
retry(nil, 1000, function()
- eq(0, funcs.isdirectory(tmpdir1))
+ eq(0, fn.isdirectory(tmpdir1))
end)
- local tmpname2 = funcs.tempname()
- local tmpdir2 = funcs.fnamemodify(tmpname2, ':h')
+ local tmpname2 = fn.tempname()
+ local tmpdir2 = fn.fnamemodify(tmpname2, ':h')
neq(tmpdir1, tmpdir2)
end
-- Your antivirus hates you...
rm_tmpdir()
assert_log('tempdir disappeared', testlog, 100)
- funcs.tempname()
- funcs.tempname()
- funcs.tempname()
- eq('', meths.nvim_get_vvar('errmsg'))
+ fn.tempname()
+ fn.tempname()
+ fn.tempname()
+ eq('', api.nvim_get_vvar('errmsg'))
rm_tmpdir()
- funcs.tempname()
- funcs.tempname()
- funcs.tempname()
- eq('E5431: tempdir disappeared (2 times)', meths.nvim_get_vvar('errmsg'))
+ fn.tempname()
+ fn.tempname()
+ fn.tempname()
+ eq('E5431: tempdir disappeared (2 times)', api.nvim_get_vvar('errmsg'))
rm_tmpdir()
- eq('E5431: tempdir disappeared (3 times)', meths.nvim_get_vvar('errmsg'))
+ eq('E5431: tempdir disappeared (3 times)', api.nvim_get_vvar('errmsg'))
end)
it('$NVIM_APPNAME relative path', function()
@@ -427,6 +427,6 @@ describe('tmpdir', function()
TMPDIR = os_tmpdir,
},
})
- matches([=[.*[/\\]a%%b%.[^/\\]+]=], funcs.tempname())
+ matches([=[.*[/\\]a%%b%.[^/\\]+]=], fn.tempname())
end)
end)
diff --git a/test/functional/core/job_spec.lua b/test/functional/core/job_spec.lua
index c0a838ed92..c6885d0b7c 100644
--- a/test/functional/core/job_spec.lua
+++ b/test/functional/core/job_spec.lua
@@ -18,10 +18,10 @@ local mkdir = helpers.mkdir
local rmdir = helpers.rmdir
local assert_alive = helpers.assert_alive
local command = helpers.command
-local funcs = helpers.funcs
+local fn = helpers.fn
local os_kill = helpers.os_kill
local retry = helpers.retry
-local meths = helpers.meths
+local api = helpers.api
local NIL = vim.NIL
local poke_eventloop = helpers.poke_eventloop
local get_pathsep = helpers.get_pathsep
@@ -42,8 +42,8 @@ describe('jobs', function()
before_each(function()
clear()
- channel = meths.nvim_get_api_info()[1]
- meths.nvim_set_var('channel', channel)
+ channel = api.nvim_get_api_info()[1]
+ api.nvim_set_var('channel', channel)
source([[
function! Normalize(data) abort
" Windows: remove ^M and term escape sequences
@@ -235,7 +235,7 @@ describe('jobs', function()
local dir = 'Xtest_not_executable_dir'
mkdir(dir)
- funcs.setfperm(dir, 'rw-------')
+ fn.setfperm(dir, 'rw-------')
matches(
'^Vim%(call%):E903: Process failed to start: permission denied: .*',
pcall_err(command, "call jobstart(['pwd'], {'cwd': '" .. dir .. "'})")
@@ -402,11 +402,11 @@ describe('jobs', function()
it('can get the pid value using getpid', function()
command("let j = jobstart(['cat', '-'], g:job_opts)")
local pid = eval('jobpid(j)')
- neq(NIL, meths.nvim_get_proc(pid))
+ neq(NIL, api.nvim_get_proc(pid))
command('call jobstop(j)')
eq({ 'notification', 'stdout', { 0, { '' } } }, next_msg())
eq({ 'notification', 'exit', { 0, 143 } }, next_msg())
- eq(NIL, meths.nvim_get_proc(pid))
+ eq(NIL, api.nvim_get_proc(pid))
end)
it('disposed on Nvim exit', function()
@@ -415,9 +415,9 @@ describe('jobs', function()
"let g:j = jobstart(has('win32') ? ['ping', '-n', '1001', '127.0.0.1'] : ['sleep', '1000'], g:job_opts)"
)
local pid = eval('jobpid(g:j)')
- neq(NIL, meths.nvim_get_proc(pid))
+ neq(NIL, api.nvim_get_proc(pid))
clear()
- eq(NIL, meths.nvim_get_proc(pid))
+ eq(NIL, api.nvim_get_proc(pid))
end)
it('can survive the exit of nvim with "detach"', function()
@@ -426,9 +426,9 @@ describe('jobs', function()
"let g:j = jobstart(has('win32') ? ['ping', '-n', '1001', '127.0.0.1'] : ['sleep', '1000'], g:job_opts)"
)
local pid = eval('jobpid(g:j)')
- neq(NIL, meths.nvim_get_proc(pid))
+ neq(NIL, api.nvim_get_proc(pid))
clear()
- neq(NIL, meths.nvim_get_proc(pid))
+ neq(NIL, api.nvim_get_proc(pid))
-- clean up after ourselves
eq(0, os_kill(pid))
end)
@@ -880,7 +880,7 @@ describe('jobs', function()
r = next_msg()
eq('job ' .. i .. ' exited', r[3][1])
end
- eq(10, meths.nvim_eval('g:counter'))
+ eq(10, api.nvim_eval('g:counter'))
end)
describe('with timeout argument', function()
@@ -945,15 +945,15 @@ describe('jobs', function()
]],
}
feed('<CR>')
- funcs.jobstop(meths.nvim_get_var('id'))
+ fn.jobstop(api.nvim_get_var('id'))
end)
end)
pending('exit event follows stdout, stderr', function()
command("let g:job_opts.on_stderr = function('OnEvent')")
command("let j = jobstart(['cat', '-'], g:job_opts)")
- meths.nvim_eval('jobsend(j, "abcdef")')
- meths.nvim_eval('jobstop(j)')
+ api.nvim_eval('jobsend(j, "abcdef")')
+ api.nvim_eval('jobstop(j)')
expect_msg_seq(
{
{ 'notification', 'stdout', { 0, { 'abcdef' } } },
@@ -1059,11 +1059,11 @@ describe('jobs', function()
end
local sleep_cmd = (is_os('win') and 'ping -n 31 127.0.0.1' or 'sleep 30')
local j = eval("jobstart('" .. sleep_cmd .. ' | ' .. sleep_cmd .. ' | ' .. sleep_cmd .. "')")
- local ppid = funcs.jobpid(j)
+ local ppid = fn.jobpid(j)
local children
if is_os('win') then
local status, result = pcall(retry, nil, nil, function()
- children = meths.nvim_get_proc_children(ppid)
+ children = api.nvim_get_proc_children(ppid)
-- On Windows conhost.exe may exist, and
-- e.g. vctip.exe might appear. #10783
ok(#children >= 3 and #children <= 5)
@@ -1075,22 +1075,22 @@ describe('jobs', function()
end
else
retry(nil, nil, function()
- children = meths.nvim_get_proc_children(ppid)
+ children = api.nvim_get_proc_children(ppid)
eq(3, #children)
end)
end
-- Assert that nvim_get_proc() sees the children.
for _, child_pid in ipairs(children) do
- local info = meths.nvim_get_proc(child_pid)
+ local info = api.nvim_get_proc(child_pid)
-- eq((is_os('win') and 'nvim.exe' or 'nvim'), info.name)
eq(ppid, info.ppid)
end
-- Kill the root of the tree.
- eq(1, funcs.jobstop(j))
+ eq(1, fn.jobstop(j))
-- Assert that the children were killed.
retry(nil, nil, function()
for _, child_pid in ipairs(children) do
- eq(NIL, meths.nvim_get_proc(child_pid))
+ eq(NIL, api.nvim_get_proc(child_pid))
end
end)
end)
@@ -1126,7 +1126,7 @@ describe('jobs', function()
local j
local function send(str)
-- check no nvim_chan_free double free with pty job (#14198)
- meths.nvim_chan_send(j, str)
+ api.nvim_chan_send(j, str)
end
before_each(function()
@@ -1241,7 +1241,7 @@ describe('pty process teardown', function()
it('does not prevent/delay exit. #4798 #4900', function()
skip(is_os('win'))
-- Use a nested nvim (in :term) to test without --headless.
- funcs.termopen({
+ fn.termopen({
helpers.nvim_prog,
'-u',
'NONE',
diff --git a/test/functional/core/main_spec.lua b/test/functional/core/main_spec.lua
index 47b96535b3..1d2261ee05 100644
--- a/test/functional/core/main_spec.lua
+++ b/test/functional/core/main_spec.lua
@@ -7,7 +7,7 @@ local matches = helpers.matches
local feed = helpers.feed
local eval = helpers.eval
local clear = helpers.clear
-local funcs = helpers.funcs
+local fn = helpers.fn
local nvim_prog_abs = helpers.nvim_prog_abs
local write_file = helpers.write_file
local is_os = helpers.is_os
@@ -33,7 +33,7 @@ describe('command-line option', function()
it('treats - as stdin', function()
eq(nil, uv.fs_stat(fname))
- funcs.system({
+ fn.system({
nvim_prog_abs(),
'-u',
'NONE',
@@ -55,7 +55,7 @@ describe('command-line option', function()
eq(nil, uv.fs_stat(fname))
eq(true, not not dollar_fname:find('%$%w+'))
write_file(dollar_fname, ':call setline(1, "100500")\n:wqall!\n')
- funcs.system({
+ fn.system({
nvim_prog_abs(),
'-u',
'NONE',
@@ -91,7 +91,7 @@ describe('command-line option', function()
-- Need to explicitly pipe to stdin so that the embedded Nvim instance doesn't try to read
-- data from the terminal #18181
- funcs.termopen(string.format([[echo "" | %s]], table.concat(args, ' ')), {
+ fn.termopen(string.format([[echo "" | %s]], table.concat(args, ' ')), {
env = { VIMRUNTIME = os.getenv('VIMRUNTIME') },
})
screen:expect(
@@ -128,7 +128,7 @@ describe('command-line option', function()
it('errors out when trying to use nonexistent file with -s', function()
eq(
'Cannot open for reading: "' .. nonexistent_fname .. '": no such file or directory\n',
- funcs.system({
+ fn.system({
nvim_prog_abs(),
'-u',
'NONE',
@@ -151,7 +151,7 @@ describe('command-line option', function()
write_file(dollar_fname, ':call setline(1, "2")\n:wqall!\n')
eq(
'Attempt to open script file again: "-s ' .. dollar_fname .. '"\n',
- funcs.system({
+ fn.system({
nvim_prog_abs(),
'-u',
'NONE',
@@ -175,9 +175,9 @@ describe('command-line option', function()
end)
it('nvim -v, :version', function()
- matches('Run ":verbose version"', funcs.execute(':version'))
- matches('Compilation: .*Run :checkhealth', funcs.execute(':verbose version'))
- matches('Run "nvim %-V1 %-v"', funcs.system({ nvim_prog_abs(), '-v' }))
- matches('Compilation: .*Run :checkhealth', funcs.system({ nvim_prog_abs(), '-V1', '-v' }))
+ matches('Run ":verbose version"', fn.execute(':version'))
+ matches('Compilation: .*Run :checkhealth', fn.execute(':verbose version'))
+ matches('Run "nvim %-V1 %-v"', fn.system({ nvim_prog_abs(), '-v' }))
+ matches('Compilation: .*Run :checkhealth', fn.system({ nvim_prog_abs(), '-V1', '-v' }))
end)
end)
diff --git a/test/functional/core/path_spec.lua b/test/functional/core/path_spec.lua
index 21364d7c03..e98bfc0d45 100644
--- a/test/functional/core/path_spec.lua
+++ b/test/functional/core/path_spec.lua
@@ -4,7 +4,7 @@ local command = helpers.command
local eq = helpers.eq
local eval = helpers.eval
local feed = helpers.feed
-local funcs = helpers.funcs
+local fn = helpers.fn
local insert = helpers.insert
local is_os = helpers.is_os
local mkdir = helpers.mkdir
@@ -167,7 +167,7 @@ describe('file search', function()
else
write_file(expected, '')
end
- eq(expected, funcs[funcname](item, d:gsub(' ', [[\ ]])))
+ eq(expected, fn[funcname](item, d:gsub(' ', [[\ ]])))
end
it('finddir()', function()
diff --git a/test/functional/core/remote_spec.lua b/test/functional/core/remote_spec.lua
index 5eb520ef4f..a48534f51b 100644
--- a/test/functional/core/remote_spec.lua
+++ b/test/functional/core/remote_spec.lua
@@ -6,7 +6,7 @@ local eq = helpers.eq
local exec_capture = helpers.exec_capture
local exec_lua = helpers.exec_lua
local expect = helpers.expect
-local funcs = helpers.funcs
+local fn = helpers.fn
local insert = helpers.insert
local nvim_prog = helpers.nvim_prog
local new_argv = helpers.new_argv
@@ -42,7 +42,7 @@ describe('Remote', function()
-- Run a `nvim --remote*` command and return { stdout, stderr } of the process
local function run_remote(...)
set_session(server)
- local addr = funcs.serverlist()[1]
+ local addr = fn.serverlist()[1]
-- Create an nvim instance just to run the remote-invoking nvim. We want
-- to wait for the remote instance to exit and calling jobwait blocks
@@ -81,20 +81,20 @@ describe('Remote', function()
it('edit a single file', function()
eq({ '', '' }, run_remote('--remote', fname))
expect(contents)
- eq(2, #funcs.getbufinfo())
+ eq(2, #fn.getbufinfo())
end)
it('tab edit a single file with a non-changed buffer', function()
eq({ '', '' }, run_remote('--remote-tab', fname))
expect(contents)
- eq(1, #funcs.gettabinfo())
+ eq(1, #fn.gettabinfo())
end)
it('tab edit a single file with a changed buffer', function()
insert('hello')
eq({ '', '' }, run_remote('--remote-tab', fname))
expect(contents)
- eq(2, #funcs.gettabinfo())
+ eq(2, #fn.gettabinfo())
end)
it('edit multiple files', function()
@@ -102,15 +102,15 @@ describe('Remote', function()
expect(contents)
command('next')
expect(other_contents)
- eq(3, #funcs.getbufinfo())
+ eq(3, #fn.getbufinfo())
end)
it('send keys', function()
eq({ '', '' }, run_remote('--remote-send', ':edit ' .. fname .. '<CR><C-W>v'))
expect(contents)
- eq(2, #funcs.getwininfo())
+ eq(2, #fn.getwininfo())
-- Only a single buffer as we're using edit and not drop like --remote does
- eq(1, #funcs.getbufinfo())
+ eq(1, #fn.getbufinfo())
end)
it('evaluate expressions', function()
@@ -127,7 +127,7 @@ describe('Remote', function()
it('creates server if not found', function()
clear('--remote', fname)
expect(contents)
- eq(1, #funcs.getbufinfo())
+ eq(1, #fn.getbufinfo())
-- Since we didn't pass silent, we should get a complaint
neq(nil, string.find(exec_capture('messages'), 'E247:'))
end)
@@ -135,8 +135,8 @@ describe('Remote', function()
it('creates server if not found with tabs', function()
clear('--remote-tab-silent', fname, other_fname)
expect(contents)
- eq(2, #funcs.gettabinfo())
- eq(2, #funcs.getbufinfo())
+ eq(2, #fn.gettabinfo())
+ eq(2, #fn.getbufinfo())
-- We passed silent, so no message should be issued about the server not being found
eq(nil, string.find(exec_capture('messages'), 'E247:'))
end)
diff --git a/test/functional/core/spellfile_spec.lua b/test/functional/core/spellfile_spec.lua
index 0e2d71ef14..7dcdfac315 100644
--- a/test/functional/core/spellfile_spec.lua
+++ b/test/functional/core/spellfile_spec.lua
@@ -2,7 +2,7 @@ local helpers = require('test.functional.helpers')(after_each)
local eq = helpers.eq
local clear = helpers.clear
-local meths = helpers.meths
+local api = helpers.api
local exc_exec = helpers.exc_exec
local rmdir = helpers.rmdir
local write_file = helpers.write_file
@@ -24,7 +24,7 @@ describe('spellfile', function()
-- │ ┌ Spell file version (#VIMSPELLVERSION)
local spellheader = 'VIMspell\050'
it('errors out when prefcond section is truncated', function()
- meths.nvim_set_option_value('runtimepath', testdir, {})
+ api.nvim_set_option_value('runtimepath', testdir, {})
-- stylua: ignore
write_file(testdir .. '/spell/en.ascii.spl',
-- ┌ Section identifier (#SN_PREFCOND)
@@ -35,11 +35,11 @@ describe('spellfile', function()
-- │ ┌ Condition length (1 byte)
-- │ │ ┌ Condition regex (missing!)
.. '\000\001\001')
- meths.nvim_set_option_value('spelllang', 'en', {})
+ api.nvim_set_option_value('spelllang', 'en', {})
eq('Vim(set):E758: Truncated spell file', exc_exec('set spell'))
end)
it('errors out when prefcond regexp contains NUL byte', function()
- meths.nvim_set_option_value('runtimepath', testdir, {})
+ api.nvim_set_option_value('runtimepath', testdir, {})
-- stylua: ignore
write_file(testdir .. '/spell/en.ascii.spl',
-- ┌ Section identifier (#SN_PREFCOND)
@@ -55,11 +55,11 @@ describe('spellfile', function()
-- │ ┌ KWORDTREE tree length (4 bytes)
-- │ │ ┌ PREFIXTREE tree length
.. '\000\000\000\000\000\000\000\000\000\000\000\000')
- meths.nvim_set_option_value('spelllang', 'en', {})
+ api.nvim_set_option_value('spelllang', 'en', {})
eq('Vim(set):E759: Format error in spell file', exc_exec('set spell'))
end)
it('errors out when region contains NUL byte', function()
- meths.nvim_set_option_value('runtimepath', testdir, {})
+ api.nvim_set_option_value('runtimepath', testdir, {})
-- stylua: ignore
write_file(testdir .. '/spell/en.ascii.spl',
-- ┌ Section identifier (#SN_REGION)
@@ -72,11 +72,11 @@ describe('spellfile', function()
-- │ ┌ KWORDTREE tree length (4 bytes)
-- │ │ ┌ PREFIXTREE tree length
.. '\000\000\000\000\000\000\000\000\000\000\000\000')
- meths.nvim_set_option_value('spelllang', 'en', {})
+ api.nvim_set_option_value('spelllang', 'en', {})
eq('Vim(set):E759: Format error in spell file', exc_exec('set spell'))
end)
it('errors out when SAL section contains NUL byte', function()
- meths.nvim_set_option_value('runtimepath', testdir, {})
+ api.nvim_set_option_value('runtimepath', testdir, {})
-- stylua: ignore
write_file(testdir .. '/spell/en.ascii.spl',
-- ┌ Section identifier (#SN_SAL)
@@ -96,13 +96,13 @@ describe('spellfile', function()
-- │ ┌ KWORDTREE tree length (4 bytes)
-- │ │ ┌ PREFIXTREE tree length
.. '\000\000\000\000\000\000\000\000\000\000\000\000')
- meths.nvim_set_option_value('spelllang', 'en', {})
+ api.nvim_set_option_value('spelllang', 'en', {})
eq('Vim(set):E759: Format error in spell file', exc_exec('set spell'))
end)
it('errors out when spell header contains NUL bytes', function()
- meths.nvim_set_option_value('runtimepath', testdir, {})
+ api.nvim_set_option_value('runtimepath', testdir, {})
write_file(testdir .. '/spell/en.ascii.spl', spellheader:sub(1, -3) .. '\000\000')
- meths.nvim_set_option_value('spelllang', 'en', {})
+ api.nvim_set_option_value('spelllang', 'en', {})
eq('Vim(set):E757: This does not look like a spell file', exc_exec('set spell'))
end)
end)
diff --git a/test/functional/core/startup_spec.lua b/test/functional/core/startup_spec.lua
index 39d38a47a5..fd3748a985 100644
--- a/test/functional/core/startup_spec.lua
+++ b/test/functional/core/startup_spec.lua
@@ -13,7 +13,7 @@ local exec = helpers.exec
local exec_capture = helpers.exec_capture
local exec_lua = helpers.exec_lua
local feed = helpers.feed
-local funcs = helpers.funcs
+local fn = helpers.fn
local pesc = vim.pesc
local mkdir = helpers.mkdir
local mkdir_p = helpers.mkdir_p
@@ -25,7 +25,7 @@ local rmdir = helpers.rmdir
local sleep = vim.uv.sleep
local startswith = vim.startswith
local write_file = helpers.write_file
-local meths = helpers.meths
+local api = helpers.api
local alter_slashes = helpers.alter_slashes
local is_os = helpers.is_os
local dedent = helpers.dedent
@@ -38,8 +38,8 @@ describe('startup', function()
clear()
ok(
string.find(
- alter_slashes(meths.nvim_get_option_value('runtimepath', {})),
- funcs.stdpath('config'),
+ alter_slashes(api.nvim_get_option_value('runtimepath', {})),
+ fn.stdpath('config'),
1,
true
) ~= nil
@@ -47,8 +47,8 @@ describe('startup', function()
clear('--clean')
ok(
string.find(
- alter_slashes(meths.nvim_get_option_value('runtimepath', {})),
- funcs.stdpath('config'),
+ alter_slashes(api.nvim_get_option_value('runtimepath', {})),
+ fn.stdpath('config'),
1,
true
) == nil
@@ -60,7 +60,7 @@ describe('startup', function()
local screen
screen = Screen.new(84, 3)
screen:attach()
- funcs.termopen({ nvim_prog, '-u', 'NONE', '--server', eval('v:servername'), '--remote-ui' })
+ fn.termopen({ nvim_prog, '-u', 'NONE', '--server', eval('v:servername'), '--remote-ui' })
screen:expect([[
^Cannot attach UI of :terminal child to its parent. (Unset $NVIM to skip this check) |
|*2
@@ -82,7 +82,7 @@ describe('startup', function()
local screen
screen = Screen.new(60, 7)
screen:attach()
- local id = funcs.termopen({
+ local id = fn.termopen({
nvim_prog,
'-u',
'NONE',
@@ -105,7 +105,7 @@ describe('startup', function()
> |
|
]])
- funcs.chansend(id, 'cont\n')
+ fn.chansend(id, 'cont\n')
screen:expect([[
^ |
~ |*3
@@ -124,13 +124,13 @@ describe('startup', function()
vim.list_extend(args, nvim_args or {})
vim.list_extend(args, { '-l', (script or 'test/functional/fixtures/startup.lua') })
vim.list_extend(args, lua_args or {})
- local out = funcs.system(args, input):gsub('\r\n', '\n')
+ local out = fn.system(args, input):gsub('\r\n', '\n')
return eq(dedent(expected), out)
end
it('failure modes', function()
-- nvim -l <empty>
- matches('nvim%.?e?x?e?: Argument missing after: "%-l"', funcs.system({ nvim_prog, '-l' }))
+ matches('nvim%.?e?x?e?: Argument missing after: "%-l"', fn.system({ nvim_prog, '-l' }))
eq(1, eval('v:shell_error'))
end)
@@ -161,12 +161,12 @@ describe('startup', function()
eq(0, eval('v:shell_error'))
matches(
'E5113: .* my pearls!!',
- funcs.system({ nvim_prog, '-l', 'test/functional/fixtures/startup-fail.lua' })
+ fn.system({ nvim_prog, '-l', 'test/functional/fixtures/startup-fail.lua' })
)
eq(1, eval('v:shell_error'))
matches(
'E5113: .* %[string "error%("whoa"%)"%]:1: whoa',
- funcs.system({ nvim_prog, '-l', '-' }, 'error("whoa")')
+ fn.system({ nvim_prog, '-l', '-' }, 'error("whoa")')
)
eq(1, eval('v:shell_error'))
end)
@@ -286,7 +286,7 @@ describe('startup', function()
end)
it('--cmd/-c/+ do not truncate long Lua print() message with --headless', function()
- local out = funcs.system({
+ local out = fn.system({
nvim_prog,
'-u',
'NONE',
@@ -305,7 +305,7 @@ describe('startup', function()
it('pipe at both ends: has("ttyin")==0 has("ttyout")==0', function()
-- system() puts a pipe at both ends.
- local out = funcs.system({
+ local out = fn.system({
nvim_prog,
'-u',
'NONE',
@@ -340,7 +340,7 @@ describe('startup', function()
command([[set shellcmdflag=/s\ /c shellxquote=\"]])
end
-- Running in :terminal
- funcs.termopen({
+ fn.termopen({
nvim_prog,
'-u',
'NONE',
@@ -372,7 +372,7 @@ describe('startup', function()
os.remove('Xtest_startup_ttyout')
end)
-- Running in :terminal
- funcs.termopen(
+ fn.termopen(
(
[["%s" -u NONE -i NONE --cmd "%s"]]
.. [[ -c "call writefile([has('ttyin'), has('ttyout')], 'Xtest_startup_ttyout')"]]
@@ -402,7 +402,7 @@ describe('startup', function()
os.remove('Xtest_startup_ttyout')
end)
-- Running in :terminal
- funcs.termopen(
+ fn.termopen(
(
[[echo foo | ]] -- Input from a pipe.
.. [["%s" -u NONE -i NONE --cmd "%s"]]
@@ -431,7 +431,7 @@ describe('startup', function()
command([[set shellcmdflag=/s\ /c shellxquote=\"]])
end
-- Running in :terminal
- funcs.termopen(
+ fn.termopen(
(
[[echo foo | ]]
.. [["%s" -u NONE -i NONE --cmd "%s"]]
@@ -454,7 +454,7 @@ describe('startup', function()
it('input from pipe + file args #7679', function()
eq(
'ohyeah\r\n0 0 bufs=3',
- funcs.system({
+ fn.system({
nvim_prog,
'-n',
'-u',
@@ -475,7 +475,7 @@ describe('startup', function()
it('if stdin is empty: selects buffer 2, deletes buffer 1 #8561', function()
eq(
'\r\n 2 %a "file1" line 0\r\n 3 "file2" line 0',
- funcs.system({
+ fn.system({
nvim_prog,
'-n',
'-u',
@@ -501,7 +501,7 @@ describe('startup', function()
--
eq(
'partylikeits1999\n',
- funcs.system({
+ fn.system({
nvim_prog,
'-n',
'-u',
@@ -513,16 +513,16 @@ describe('startup', function()
'test/functional/fixtures/tty-test.c',
}, { 'partylikeits1999', '' })
)
- eq(inputstr, funcs.system({ nvim_prog, '-i', 'NONE', '-Es', '+%print', '-' }, input))
+ eq(inputstr, fn.system({ nvim_prog, '-i', 'NONE', '-Es', '+%print', '-' }, input))
-- with `-u NORC`
eq(
'thepartycontinues\n',
- funcs.system({ nvim_prog, '-n', '-u', 'NORC', '-Es', '+.print' }, { 'thepartycontinues', '' })
+ fn.system({ nvim_prog, '-n', '-u', 'NORC', '-Es', '+.print' }, { 'thepartycontinues', '' })
)
-- without `-u`
eq(
'thepartycontinues\n',
- funcs.system({ nvim_prog, '-n', '-Es', '+.print' }, { 'thepartycontinues', '' })
+ fn.system({ nvim_prog, '-n', '-Es', '+.print' }, { 'thepartycontinues', '' })
)
--
@@ -530,7 +530,7 @@ describe('startup', function()
--
eq(
' encoding=utf-8\n',
- funcs.system({
+ fn.system({
nvim_prog,
'-n',
'-u',
@@ -541,19 +541,19 @@ describe('startup', function()
'test/functional/fixtures/tty-test.c',
}, { 'set encoding', '' })
)
- eq('line1\nline2\n', funcs.system({ nvim_prog, '-i', 'NONE', '-es', '-' }, input))
+ eq('line1\nline2\n', fn.system({ nvim_prog, '-i', 'NONE', '-es', '-' }, input))
-- with `-u NORC`
eq(
' encoding=utf-8\n',
- funcs.system({ nvim_prog, '-n', '-u', 'NORC', '-es' }, { 'set encoding', '' })
+ fn.system({ nvim_prog, '-n', '-u', 'NORC', '-es' }, { 'set encoding', '' })
)
-- without `-u`
- eq(' encoding=utf-8\n', funcs.system({ nvim_prog, '-n', '-es' }, { 'set encoding', '' }))
+ eq(' encoding=utf-8\n', fn.system({ nvim_prog, '-n', '-es' }, { 'set encoding', '' }))
end)
it('-es/-Es disables swapfile, user config #8540', function()
for _, arg in ipairs({ '-es', '-Es' }) do
- local out = funcs.system({
+ local out = fn.system({
nvim_prog,
arg,
'+set swapfile? updatecount? shadafile?',
@@ -572,15 +572,15 @@ describe('startup', function()
it('fails on --embed with -es/-Es/-l', function()
matches(
'nvim[.exe]*: %-%-embed conflicts with %-es/%-Es/%-l',
- funcs.system({ nvim_prog, '--embed', '-es' })
+ fn.system({ nvim_prog, '--embed', '-es' })
)
matches(
'nvim[.exe]*: %-%-embed conflicts with %-es/%-Es/%-l',
- funcs.system({ nvim_prog, '--embed', '-Es' })
+ fn.system({ nvim_prog, '--embed', '-Es' })
)
matches(
'nvim[.exe]*: %-%-embed conflicts with %-es/%-Es/%-l',
- funcs.system({ nvim_prog, '--embed', '-l', 'foo.lua' })
+ fn.system({ nvim_prog, '--embed', '-l', 'foo.lua' })
)
end)
@@ -588,7 +588,7 @@ describe('startup', function()
local screen
screen = Screen.new(60, 6)
screen:attach()
- local id = funcs.termopen({
+ local id = fn.termopen({
nvim_prog,
'-u',
'NONE',
@@ -611,7 +611,7 @@ describe('startup', function()
Press ENTER or type command to continue |
|
]])
- funcs.chansend(id, '\n')
+ fn.chansend(id, '\n')
screen:expect([[
^ |
~ |*2
@@ -651,7 +651,7 @@ describe('startup', function()
expected,
-- FIXME(codehex): We should really set a timeout for the system function.
-- If this test fails, there will be a waiting input state.
- funcs.system({
+ fn.system({
nvim_prog,
'-u',
'NONE',
@@ -663,7 +663,7 @@ describe('startup', function()
end)
it('get command line arguments from v:argv', function()
- local out = funcs.system({
+ local out = fn.system({
nvim_prog,
'-u',
'NONE',
@@ -715,7 +715,7 @@ describe('startup', function()
:put =mode(1) |
]])
- eq('cv\n', funcs.system({ nvim_prog, '-n', '-es' }, { 'put =mode(1)', 'print', '' }))
+ eq('cv\n', fn.system({ nvim_prog, '-n', '-es' }, { 'put =mode(1)', 'print', '' }))
end)
it('-d does not diff non-arglist windows #13720 #21289', function()
@@ -737,11 +737,11 @@ describe('startup', function()
os.remove('Xdiff.vim')
end)
clear { args = { '-u', 'Xdiff.vim', '-d', 'Xdiff.vim', 'Xdiff.vim' } }
- eq(true, meths.nvim_get_option_value('diff', { win = funcs.win_getid(1) }))
- eq(true, meths.nvim_get_option_value('diff', { win = funcs.win_getid(2) }))
- local float_win = funcs.win_getid(3)
- eq('editor', meths.nvim_win_get_config(float_win).relative)
- eq(false, meths.nvim_get_option_value('diff', { win = float_win }))
+ eq(true, api.nvim_get_option_value('diff', { win = fn.win_getid(1) }))
+ eq(true, api.nvim_get_option_value('diff', { win = fn.win_getid(2) }))
+ local float_win = fn.win_getid(3)
+ eq('editor', api.nvim_win_get_config(float_win).relative)
+ eq(false, api.nvim_get_option_value('diff', { win = float_win }))
end)
it('does not crash if --embed is given twice', function()
@@ -870,7 +870,7 @@ describe('startup', function()
exec_lua [[ return _G.test_loadorder ]]
)
- local rtp = meths.nvim_get_option_value('rtp', {})
+ local rtp = api.nvim_get_option_value('rtp', {})
ok(
startswith(
rtp,
@@ -963,9 +963,9 @@ describe('startup', function()
os.remove('Xtab2.noft')
end)
clear({ args = { '-p', 'Xtab1.noft', 'Xtab2.noft' } })
- eq(81, meths.nvim_win_get_width(0))
+ eq(81, api.nvim_win_get_width(0))
command('tabnext')
- eq(81, meths.nvim_win_get_width(0))
+ eq(81, api.nvim_win_get_width(0))
end)
end)
@@ -1062,7 +1062,7 @@ describe('user config init', function()
clear { args_rm = { '-u' }, env = xenv }
eq(1, eval('g:lua_rc'))
- eq(funcs.fnamemodify(init_lua_path, ':p'), eval('$MYVIMRC'))
+ eq(fn.fnamemodify(init_lua_path, ':p'), eval('$MYVIMRC'))
end)
describe('loads existing', function()
@@ -1122,7 +1122,7 @@ describe('user config init', function()
local screen = Screen.new(50, 8)
screen:attach()
- funcs.termopen({ nvim_prog }, {
+ fn.termopen({ nvim_prog }, {
env = {
VIMRUNTIME = os.getenv('VIMRUNTIME'),
},
@@ -1245,7 +1245,7 @@ describe('runtime:', function()
-- Check if plugin_file_path is listed in getscriptinfo()
local scripts = tbl_map(function(s)
return s.name
- end, funcs.getscriptinfo())
+ end, fn.getscriptinfo())
ok(#tbl_filter(function(s)
return endswith(s, plugin_file_path)
end, scripts) > 0)
@@ -1369,13 +1369,13 @@ describe('inccommand on ex mode', function()
local screen
screen = Screen.new(60, 10)
screen:attach()
- local id = funcs.termopen(
+ local id = fn.termopen(
{ nvim_prog, '-u', 'NONE', '-c', 'set termguicolors', '-E', 'test/README.md' },
{
env = { VIMRUNTIME = os.getenv('VIMRUNTIME') },
}
)
- funcs.chansend(id, '%s/N')
+ fn.chansend(id, '%s/N')
screen:expect {
grid = [[
{1:^ }|