aboutsummaryrefslogtreecommitdiff
path: root/test/functional/ex_cmds
diff options
context:
space:
mode:
authorLewis Russell <lewis6991@gmail.com>2024-01-12 17:59:57 +0000
committerLewis Russell <lewis6991@gmail.com>2024-01-12 18:59:14 +0000
commit795f896a5772d5e0795f86642bdf90c82efac45c (patch)
tree308f04fbee18d2ec3f00c12a8bec96b84d8907f0 /test/functional/ex_cmds
parent4f81f506f96f8b5bfcf00e952ceb492d3ce9dc6e (diff)
downloadrneovim-795f896a5772d5e0795f86642bdf90c82efac45c.tar.gz
rneovim-795f896a5772d5e0795f86642bdf90c82efac45c.tar.bz2
rneovim-795f896a5772d5e0795f86642bdf90c82efac45c.zip
test: rename (meths, funcs) -> (api, fn)
Diffstat (limited to 'test/functional/ex_cmds')
-rw-r--r--test/functional/ex_cmds/append_spec.lua20
-rw-r--r--test/functional/ex_cmds/arg_spec.lua12
-rw-r--r--test/functional/ex_cmds/cmd_map_spec.lua36
-rw-r--r--test/functional/ex_cmds/dict_notifications_spec.lua6
-rw-r--r--test/functional/ex_cmds/echo_spec.lua98
-rw-r--r--test/functional/ex_cmds/edit_spec.lua12
-rw-r--r--test/functional/ex_cmds/excmd_spec.lua22
-rw-r--r--test/functional/ex_cmds/file_spec.lua4
-rw-r--r--test/functional/ex_cmds/help_spec.lua14
-rw-r--r--test/functional/ex_cmds/highlight_spec.lua18
-rw-r--r--test/functional/ex_cmds/ls_spec.lua4
-rw-r--r--test/functional/ex_cmds/make_spec.lua6
-rw-r--r--test/functional/ex_cmds/map_spec.lua26
-rw-r--r--test/functional/ex_cmds/menu_spec.lua14
-rw-r--r--test/functional/ex_cmds/mksession_spec.lua62
-rw-r--r--test/functional/ex_cmds/mkview_spec.lua8
-rw-r--r--test/functional/ex_cmds/normal_spec.lua10
-rw-r--r--test/functional/ex_cmds/oldfiles_spec.lua22
-rw-r--r--test/functional/ex_cmds/print_commands_spec.lua4
-rw-r--r--test/functional/ex_cmds/quickfix_commands_spec.lua22
-rw-r--r--test/functional/ex_cmds/script_spec.lua4
-rw-r--r--test/functional/ex_cmds/sign_spec.lua10
-rw-r--r--test/functional/ex_cmds/source_spec.lua28
-rw-r--r--test/functional/ex_cmds/swapfile_preserve_recover_spec.lua26
-rw-r--r--test/functional/ex_cmds/trust_spec.lua28
-rw-r--r--test/functional/ex_cmds/verbose_spec.lua2
-rw-r--r--test/functional/ex_cmds/wincmd_spec.lua6
-rw-r--r--test/functional/ex_cmds/write_spec.lua26
28 files changed, 275 insertions, 275 deletions
diff --git a/test/functional/ex_cmds/append_spec.lua b/test/functional/ex_cmds/append_spec.lua
index 27e56de54e..5eb8d49c74 100644
--- a/test/functional/ex_cmds/append_spec.lua
+++ b/test/functional/ex_cmds/append_spec.lua
@@ -5,20 +5,20 @@ local dedent = helpers.dedent
local exec = helpers.exec
local feed = helpers.feed
local clear = helpers.clear
-local funcs = helpers.funcs
+local fn = helpers.fn
local command = helpers.command
-local meths = helpers.meths
+local api = helpers.api
local Screen = require('test.functional.ui.screen')
local cmdtest = function(cmd, prep, ret1)
describe(':' .. cmd, function()
before_each(function()
clear()
- meths.nvim_buf_set_lines(0, 0, 1, true, { 'foo', 'bar', 'baz' })
+ api.nvim_buf_set_lines(0, 0, 1, true, { 'foo', 'bar', 'baz' })
end)
local buffer_contents = function()
- return meths.nvim_buf_get_lines(0, 0, -1, false)
+ return api.nvim_buf_get_lines(0, 0, -1, false)
end
it(cmd .. 's' .. prep .. ' the current line by default', function()
@@ -38,15 +38,15 @@ local cmdtest = function(cmd, prep, ret1)
feed(':' .. hisline .. '<CR>')
feed(':' .. cmd .. '<CR>abc<CR>def<C-f>')
eq({ 'def' }, buffer_contents())
- eq(hisline, funcs.histget(':', -2))
- eq(cmd, funcs.histget(':'))
+ eq(hisline, fn.histget(':', -2))
+ eq(cmd, fn.histget(':'))
-- Test that command-line window was launched
- eq('nofile', meths.nvim_get_option_value('buftype', {}))
- eq('n', funcs.mode(1))
+ eq('nofile', api.nvim_get_option_value('buftype', {}))
+ eq('n', fn.mode(1))
feed('<CR>')
- eq('c', funcs.mode(1))
+ eq('c', fn.mode(1))
feed('.<CR>')
- eq('n', funcs.mode(1))
+ eq('n', fn.mode(1))
eq(ret1, buffer_contents())
end)
end)
diff --git a/test/functional/ex_cmds/arg_spec.lua b/test/functional/ex_cmds/arg_spec.lua
index 1cb758cd23..810b001ec0 100644
--- a/test/functional/ex_cmds/arg_spec.lua
+++ b/test/functional/ex_cmds/arg_spec.lua
@@ -1,5 +1,5 @@
local helpers = require('test.functional.helpers')(after_each)
-local eq, command, funcs = helpers.eq, helpers.command, helpers.funcs
+local eq, command, fn = helpers.eq, helpers.command, helpers.fn
local ok = helpers.ok
local clear = helpers.clear
@@ -13,17 +13,17 @@ describe(':argument', function()
helpers.feed([[<C-\><C-N>]])
command('argadd')
helpers.feed([[<C-\><C-N>]])
- local bufname_before = funcs.bufname('%')
- local bufnr_before = funcs.bufnr('%')
+ local bufname_before = fn.bufname('%')
+ local bufnr_before = fn.bufnr('%')
helpers.ok(nil ~= string.find(bufname_before, '^term://')) -- sanity
command('argument 1')
helpers.feed([[<C-\><C-N>]])
- local bufname_after = funcs.bufname('%')
- local bufnr_after = funcs.bufnr('%')
+ local bufname_after = fn.bufname('%')
+ local bufnr_after = fn.bufnr('%')
eq('[' .. bufname_before .. ']', helpers.eval('trim(execute("args"))'))
- ok(funcs.line('$') > 1)
+ ok(fn.line('$') > 1)
eq(bufname_before, bufname_after)
eq(bufnr_before, bufnr_after)
end)
diff --git a/test/functional/ex_cmds/cmd_map_spec.lua b/test/functional/ex_cmds/cmd_map_spec.lua
index c1a4fee38d..da7d686e5b 100644
--- a/test/functional/ex_cmds/cmd_map_spec.lua
+++ b/test/functional/ex_cmds/cmd_map_spec.lua
@@ -4,7 +4,7 @@ local feed = helpers.feed
local eq = helpers.eq
local expect = helpers.expect
local eval = helpers.eval
-local funcs = helpers.funcs
+local fn = helpers.fn
local insert = helpers.insert
local write_file = helpers.write_file
local exc_exec = helpers.exc_exec
@@ -329,12 +329,12 @@ describe('mappings with <Cmd>', function()
{1:~ }|*5
{4:-- VISUAL --} |
]])
- eq('v', funcs.mode(1))
+ eq('v', fn.mode(1))
-- can invoke operator, ending visual mode
feed('<F5>')
- eq('n', funcs.mode(1))
- eq({ 'some short l' }, funcs.getreg('a', 1, 1))
+ eq('n', fn.mode(1))
+ eq({ 'some short l' }, fn.getreg('a', 1, 1))
-- error doesn't interrupt visual mode
feed('ggvw<F6>')
@@ -356,7 +356,7 @@ describe('mappings with <Cmd>', function()
{1:~ }|*5
{4:-- VISUAL --} |
]])
- eq('v', funcs.mode(1))
+ eq('v', fn.mode(1))
feed('<F7>')
screen:expect([[
so{5:me short lines} |
@@ -364,7 +364,7 @@ describe('mappings with <Cmd>', function()
{1:~ }|*5
{4:-- VISUAL --} |
]])
- eq('v', funcs.mode(1))
+ eq('v', fn.mode(1))
-- startinsert gives "-- (insert) VISUAL --" mode
feed('<F8>')
@@ -390,17 +390,17 @@ describe('mappings with <Cmd>', function()
{1:~ }|*5
{4:-- SELECT --} |
]])
- eq('s', funcs.mode(1))
+ eq('s', fn.mode(1))
-- visual mapping in select mode restart select mode after operator
feed('<F5>')
- eq('s', funcs.mode(1))
- eq({ 'some short l' }, funcs.getreg('a', 1, 1))
+ eq('s', fn.mode(1))
+ eq({ 'some short l' }, fn.getreg('a', 1, 1))
-- select mode mapping works, and does not restart select mode
feed('<F2>')
- eq('n', funcs.mode(1))
- eq({ 'some short l' }, funcs.getreg('b', 1, 1))
+ eq('n', fn.mode(1))
+ eq({ 'some short l' }, fn.getreg('b', 1, 1))
-- error doesn't interrupt temporary visual mode
feed('<esc>ggvw<c-g><F6>')
@@ -423,7 +423,7 @@ describe('mappings with <Cmd>', function()
{4:-- VISUAL --} |
]])
-- quirk: restoration of select mode is not performed
- eq('v', funcs.mode(1))
+ eq('v', fn.mode(1))
-- error doesn't interrupt select mode
feed('<esc>ggvw<c-g><F1>')
@@ -446,7 +446,7 @@ describe('mappings with <Cmd>', function()
{4:-- SELECT --} |
]])
-- quirk: restoration of select mode is not performed
- eq('s', funcs.mode(1))
+ eq('s', fn.mode(1))
feed('<F7>')
screen:expect([[
@@ -455,7 +455,7 @@ describe('mappings with <Cmd>', function()
{1:~ }|*5
{4:-- SELECT --} |
]])
- eq('s', funcs.mode(1))
+ eq('s', fn.mode(1))
-- startinsert gives "-- SELECT (insert) --" mode
feed('<F8>')
@@ -475,11 +475,11 @@ describe('mappings with <Cmd>', function()
expect([[
lines
of test text]])
- eq({ 'some short ' }, funcs.getreg('"', 1, 1))
+ eq({ 'some short ' }, fn.getreg('"', 1, 1))
feed('.')
expect([[
test text]])
- eq({ 'lines', 'of ' }, funcs.getreg('"', 1, 1))
+ eq({ 'lines', 'of ' }, fn.getreg('"', 1, 1))
feed('uu')
expect([[
some short lines
@@ -505,7 +505,7 @@ describe('mappings with <Cmd>', function()
feed('"bd<F7>')
expect([[
soest text]])
- eq(funcs.getreg('b', 1, 1), { 'me short lines', 'of t' })
+ eq(fn.getreg('b', 1, 1), { 'me short lines', 'of t' })
-- startinsert aborts operator
feed('d<F8>')
@@ -561,7 +561,7 @@ describe('mappings with <Cmd>', function()
of stuff test text]])
feed('<F5>')
- eq(funcs.getreg('a', 1, 1), { 'deed some short little lines', 'of stuff t' })
+ eq(fn.getreg('a', 1, 1), { 'deed some short little lines', 'of stuff t' })
-- still in insert
screen:expect([[
diff --git a/test/functional/ex_cmds/dict_notifications_spec.lua b/test/functional/ex_cmds/dict_notifications_spec.lua
index 439d28d59a..15fbb750f6 100644
--- a/test/functional/ex_cmds/dict_notifications_spec.lua
+++ b/test/functional/ex_cmds/dict_notifications_spec.lua
@@ -1,7 +1,7 @@
local helpers = require('test.functional.helpers')(after_each)
local assert_alive = helpers.assert_alive
local clear, source = helpers.clear, helpers.source
-local meths = helpers.meths
+local api = helpers.api
local insert = helpers.insert
local eq, next_msg = helpers.eq, helpers.next_msg
local exc_exec = helpers.exc_exec
@@ -14,8 +14,8 @@ describe('Vimscript dictionary notifications', 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)
end)
-- the same set of tests are applied to top-level dictionaries(g:, b:, w: and
diff --git a/test/functional/ex_cmds/echo_spec.lua b/test/functional/ex_cmds/echo_spec.lua
index bfc8f57632..e9176a6204 100644
--- a/test/functional/ex_cmds/echo_spec.lua
+++ b/test/functional/ex_cmds/echo_spec.lua
@@ -4,8 +4,8 @@ local eq = helpers.eq
local NIL = vim.NIL
local eval = helpers.eval
local clear = helpers.clear
-local meths = helpers.meths
-local funcs = helpers.funcs
+local api = helpers.api
+local fn = helpers.fn
local source = helpers.source
local dedent = helpers.dedent
local command = helpers.command
@@ -17,12 +17,12 @@ describe(':echo :echon :echomsg :echoerr', function()
local fn_tbl = { 'String', 'StringN', 'StringMsg', 'StringErr' }
local function assert_same_echo_dump(expected, input, use_eval)
for _, v in pairs(fn_tbl) do
- eq(expected, use_eval and eval(v .. '(' .. input .. ')') or funcs[v](input))
+ eq(expected, use_eval and eval(v .. '(' .. input .. ')') or fn[v](input))
end
end
local function assert_matches_echo_dump(expected, input, use_eval)
for _, v in pairs(fn_tbl) do
- matches(expected, use_eval and eval(v .. '(' .. input .. ')') or funcs[v](input))
+ matches(expected, use_eval and eval(v .. '(' .. input .. ')') or fn[v](input))
end
end
@@ -68,21 +68,21 @@ describe(':echo :echon :echomsg :echoerr', function()
eq('v:true', eval('String(v:true)'))
eq('v:false', eval('String(v:false)'))
eq('v:null', eval('String(v:null)'))
- eq('v:true', funcs.String(true))
- eq('v:false', funcs.String(false))
- eq('v:null', funcs.String(NIL))
+ eq('v:true', fn.String(true))
+ eq('v:false', fn.String(false))
+ eq('v:null', fn.String(NIL))
eq('v:true', eval('StringMsg(v:true)'))
eq('v:false', eval('StringMsg(v:false)'))
eq('v:null', eval('StringMsg(v:null)'))
- eq('v:true', funcs.StringMsg(true))
- eq('v:false', funcs.StringMsg(false))
- eq('v:null', funcs.StringMsg(NIL))
+ eq('v:true', fn.StringMsg(true))
+ eq('v:false', fn.StringMsg(false))
+ eq('v:null', fn.StringMsg(NIL))
eq('v:true', eval('StringErr(v:true)'))
eq('v:false', eval('StringErr(v:false)'))
eq('v:null', eval('StringErr(v:null)'))
- eq('v:true', funcs.StringErr(true))
- eq('v:false', funcs.StringErr(false))
- eq('v:null', funcs.StringErr(NIL))
+ eq('v:true', fn.StringErr(true))
+ eq('v:false', fn.StringErr(false))
+ eq('v:null', fn.StringErr(NIL))
end)
it('dumps values with at most six digits after the decimal point', function()
@@ -223,7 +223,7 @@ describe(':echo :echon :echomsg :echoerr', function()
end)
it('does not crash or halt when dumping partials with reference cycles in self', function()
- meths.nvim_set_var('d', { v = true })
+ api.nvim_set_var('d', { v = true })
eq(
dedent(
[[
@@ -251,7 +251,7 @@ describe(':echo :echon :echomsg :echoerr', function()
end)
it('does not crash or halt when dumping partials with reference cycles in arguments', function()
- meths.nvim_set_var('l', {})
+ api.nvim_set_var('l', {})
eval('add(l, l)')
-- Regression: the below line used to crash (add returns original list and
-- there was error in dumping partials). Tested explicitly in
@@ -269,8 +269,8 @@ describe(':echo :echon :echomsg :echoerr', function()
it(
'does not crash or halt when dumping partials with reference cycles in self and arguments',
function()
- meths.nvim_set_var('d', { v = true })
- meths.nvim_set_var('l', {})
+ api.nvim_set_var('d', { v = true })
+ api.nvim_set_var('l', {})
eval('add(l, l)')
eval('add(l, function("Test1", l))')
eval('add(l, function("Test1", d))')
@@ -305,13 +305,13 @@ describe(':echo :echon :echomsg :echoerr', function()
end)
it('does not error when dumping recursive lists', function()
- meths.nvim_set_var('l', {})
+ api.nvim_set_var('l', {})
eval('add(l, l)')
eq(0, exc_exec('echo String(l)'))
end)
it('dumps recursive lists without error', function()
- meths.nvim_set_var('l', {})
+ api.nvim_set_var('l', {})
eval('add(l, l)')
eq('[[...@0]]', exec_capture('echo String(l)'))
eq('[[[...@1]]]', exec_capture('echo String([l])'))
@@ -335,13 +335,13 @@ describe(':echo :echon :echomsg :echoerr', function()
end)
it('does not error when dumping recursive dictionaries', function()
- meths.nvim_set_var('d', { d = 1 })
+ api.nvim_set_var('d', { d = 1 })
eval('extend(d, {"d": d})')
eq(0, exc_exec('echo String(d)'))
end)
it('dumps recursive dictionaries without the error', function()
- meths.nvim_set_var('d', { d = 1 })
+ api.nvim_set_var('d', { d = 1 })
eval('extend(d, {"d": d})')
eq("{'d': {...@0}}", exec_capture('echo String(d)'))
eq("{'out': {'d': {...@1}}}", exec_capture('echo String({"out": d})'))
@@ -358,43 +358,43 @@ describe(':echo :echon :echomsg :echoerr', function()
it('displays hex as hex', function()
-- Regression: due to missing (uint8_t) cast \x80 was represented as
-- ~@<80>.
- eq('<80>', funcs.String(chr(0x80)))
- eq('<81>', funcs.String(chr(0x81)))
- eq('<8e>', funcs.String(chr(0x8e)))
- eq('<c2>', funcs.String(('«'):sub(1, 1)))
- eq('«', funcs.String(('«'):sub(1, 2)))
-
- eq('<80>', funcs.StringMsg(chr(0x80)))
- eq('<81>', funcs.StringMsg(chr(0x81)))
- eq('<8e>', funcs.StringMsg(chr(0x8e)))
- eq('<c2>', funcs.StringMsg(('«'):sub(1, 1)))
- eq('«', funcs.StringMsg(('«'):sub(1, 2)))
+ eq('<80>', fn.String(chr(0x80)))
+ eq('<81>', fn.String(chr(0x81)))
+ eq('<8e>', fn.String(chr(0x8e)))
+ eq('<c2>', fn.String(('«'):sub(1, 1)))
+ eq('«', fn.String(('«'):sub(1, 2)))
+
+ eq('<80>', fn.StringMsg(chr(0x80)))
+ eq('<81>', fn.StringMsg(chr(0x81)))
+ eq('<8e>', fn.StringMsg(chr(0x8e)))
+ eq('<c2>', fn.StringMsg(('«'):sub(1, 1)))
+ eq('«', fn.StringMsg(('«'):sub(1, 2)))
end)
it('displays ASCII control characters using ^X notation', function()
- eq('^C', funcs.String(ctrl('c')))
- eq('^A', funcs.String(ctrl('a')))
- eq('^F', funcs.String(ctrl('f')))
- eq('^C', funcs.StringMsg(ctrl('c')))
- eq('^A', funcs.StringMsg(ctrl('a')))
- eq('^F', funcs.StringMsg(ctrl('f')))
+ eq('^C', fn.String(ctrl('c')))
+ eq('^A', fn.String(ctrl('a')))
+ eq('^F', fn.String(ctrl('f')))
+ eq('^C', fn.StringMsg(ctrl('c')))
+ eq('^A', fn.StringMsg(ctrl('a')))
+ eq('^F', fn.StringMsg(ctrl('f')))
end)
it('prints CR, NL and tab as-is', function()
- eq('\n', funcs.String('\n'))
- eq('\r', funcs.String('\r'))
- eq('\t', funcs.String('\t'))
+ eq('\n', fn.String('\n'))
+ eq('\r', fn.String('\r'))
+ eq('\t', fn.String('\t'))
end)
it('prints non-printable UTF-8 in <> notation', function()
-- SINGLE SHIFT TWO, unicode control
- eq('<8e>', funcs.String(funcs.nr2char(0x8E)))
- eq('<8e>', funcs.StringMsg(funcs.nr2char(0x8E)))
+ eq('<8e>', fn.String(fn.nr2char(0x8E)))
+ eq('<8e>', fn.StringMsg(fn.nr2char(0x8E)))
-- Surrogate pair: U+1F0A0 PLAYING CARD BACK is represented in UTF-16 as
-- 0xD83C 0xDCA0. This is not valid in UTF-8.
- eq('<d83c>', funcs.String(funcs.nr2char(0xD83C)))
- eq('<dca0>', funcs.String(funcs.nr2char(0xDCA0)))
- eq('<d83c><dca0>', funcs.String(funcs.nr2char(0xD83C) .. funcs.nr2char(0xDCA0)))
- eq('<d83c>', funcs.StringMsg(funcs.nr2char(0xD83C)))
- eq('<dca0>', funcs.StringMsg(funcs.nr2char(0xDCA0)))
- eq('<d83c><dca0>', funcs.StringMsg(funcs.nr2char(0xD83C) .. funcs.nr2char(0xDCA0)))
+ eq('<d83c>', fn.String(fn.nr2char(0xD83C)))
+ eq('<dca0>', fn.String(fn.nr2char(0xDCA0)))
+ eq('<d83c><dca0>', fn.String(fn.nr2char(0xD83C) .. fn.nr2char(0xDCA0)))
+ eq('<d83c>', fn.StringMsg(fn.nr2char(0xD83C)))
+ eq('<dca0>', fn.StringMsg(fn.nr2char(0xDCA0)))
+ eq('<d83c><dca0>', fn.StringMsg(fn.nr2char(0xD83C) .. fn.nr2char(0xDCA0)))
end)
end)
end)
diff --git a/test/functional/ex_cmds/edit_spec.lua b/test/functional/ex_cmds/edit_spec.lua
index 48ae99a0fa..b927fa418a 100644
--- a/test/functional/ex_cmds/edit_spec.lua
+++ b/test/functional/ex_cmds/edit_spec.lua
@@ -1,5 +1,5 @@
local helpers = require('test.functional.helpers')(after_each)
-local eq, command, funcs = helpers.eq, helpers.command, helpers.funcs
+local eq, command, fn = helpers.eq, helpers.command, helpers.fn
local ok = helpers.ok
local clear = helpers.clear
local feed = helpers.feed
@@ -12,15 +12,15 @@ describe(':edit', function()
it('without arguments does not restart :terminal buffer', function()
command('terminal')
feed([[<C-\><C-N>]])
- local bufname_before = funcs.bufname('%')
- local bufnr_before = funcs.bufnr('%')
+ local bufname_before = fn.bufname('%')
+ local bufnr_before = fn.bufnr('%')
helpers.ok(nil ~= string.find(bufname_before, '^term://')) -- sanity
command('edit')
- local bufname_after = funcs.bufname('%')
- local bufnr_after = funcs.bufnr('%')
- ok(funcs.line('$') > 1)
+ local bufname_after = fn.bufname('%')
+ local bufnr_after = fn.bufnr('%')
+ ok(fn.line('$') > 1)
eq(bufname_before, bufname_after)
eq(bufnr_before, bufnr_after)
end)
diff --git a/test/functional/ex_cmds/excmd_spec.lua b/test/functional/ex_cmds/excmd_spec.lua
index 030816c6cb..d16a52ee62 100644
--- a/test/functional/ex_cmds/excmd_spec.lua
+++ b/test/functional/ex_cmds/excmd_spec.lua
@@ -2,7 +2,7 @@ local helpers = require('test.functional.helpers')(after_each)
local command = helpers.command
local eq = helpers.eq
local clear = helpers.clear
-local funcs = helpers.funcs
+local fn = helpers.fn
local pcall_err = helpers.pcall_err
local assert_alive = helpers.assert_alive
@@ -49,15 +49,15 @@ describe('Ex cmds', function()
it(':def is an unknown command #23149', function()
eq('Vim:E492: Not an editor command: def', pcall_err(command, 'def'))
- eq(1, funcs.exists(':d'))
- eq('delete', funcs.fullcommand('d'))
- eq(1, funcs.exists(':de'))
- eq('delete', funcs.fullcommand('de'))
- eq(0, funcs.exists(':def'))
- eq('', funcs.fullcommand('def'))
- eq(1, funcs.exists(':defe'))
- eq('defer', funcs.fullcommand('defe'))
- eq(2, funcs.exists(':defer'))
- eq('defer', funcs.fullcommand('defer'))
+ eq(1, fn.exists(':d'))
+ eq('delete', fn.fullcommand('d'))
+ eq(1, fn.exists(':de'))
+ eq('delete', fn.fullcommand('de'))
+ eq(0, fn.exists(':def'))
+ eq('', fn.fullcommand('def'))
+ eq(1, fn.exists(':defe'))
+ eq('defer', fn.fullcommand('defe'))
+ eq(2, fn.exists(':defer'))
+ eq('defer', fn.fullcommand('defer'))
end)
end)
diff --git a/test/functional/ex_cmds/file_spec.lua b/test/functional/ex_cmds/file_spec.lua
index ce55b61d53..a48c408600 100644
--- a/test/functional/ex_cmds/file_spec.lua
+++ b/test/functional/ex_cmds/file_spec.lua
@@ -2,7 +2,7 @@ local helpers = require('test.functional.helpers')(after_each)
local clear = helpers.clear
local command = helpers.command
local eq = helpers.eq
-local funcs = helpers.funcs
+local fn = helpers.fn
local rmdir = helpers.rmdir
local mkdir = helpers.mkdir
@@ -29,6 +29,6 @@ describe(':file', function()
command('edit! ' .. testfile)
-- Before #6487 this gave "E301: Oops, lost the swap file !!!" on Windows.
command('file ' .. testfile_renamed)
- eq(testfile_renamed .. '.swp', string.match(funcs.execute('swapname'), '[^%%]+$'))
+ eq(testfile_renamed .. '.swp', string.match(fn.execute('swapname'), '[^%%]+$'))
end)
end)
diff --git a/test/functional/ex_cmds/help_spec.lua b/test/functional/ex_cmds/help_spec.lua
index de79fadd6d..cee33de1a6 100644
--- a/test/functional/ex_cmds/help_spec.lua
+++ b/test/functional/ex_cmds/help_spec.lua
@@ -3,8 +3,8 @@ local helpers = require('test.functional.helpers')(after_each)
local clear = helpers.clear
local command = helpers.command
local eq = helpers.eq
-local funcs = helpers.funcs
-local meths = helpers.meths
+local fn = helpers.fn
+local api = helpers.api
local mkdir = helpers.mkdir
local rmdir = helpers.rmdir
local write_file = helpers.write_file
@@ -15,19 +15,19 @@ describe(':help', function()
it('window closed makes cursor return to a valid win/buf #9773', function()
helpers.add_builddir_to_rtp()
command('help help')
- eq(1001, funcs.win_getid())
+ eq(1001, fn.win_getid())
command('quit')
- eq(1000, funcs.win_getid())
+ eq(1000, fn.win_getid())
command('autocmd WinNew * wincmd p')
command('help help')
-- Window 1002 is opened, but the autocmd switches back to 1000 and
-- creates the help buffer there instead.
- eq(1000, funcs.win_getid())
+ eq(1000, fn.win_getid())
command('quit')
-- Before #9773, Nvim would crash on quitting the help window.
- eq(1002, funcs.win_getid())
+ eq(1002, fn.win_getid())
end)
it('multibyte help tags work #23975', function()
@@ -40,6 +40,6 @@ describe(':help', function()
command('helptags Xhelptags/doc')
command('set rtp+=Xhelptags')
command('help …')
- eq('*…*', meths.nvim_get_current_line())
+ eq('*…*', api.nvim_get_current_line())
end)
end)
diff --git a/test/functional/ex_cmds/highlight_spec.lua b/test/functional/ex_cmds/highlight_spec.lua
index f572728b4d..897a2997bc 100644
--- a/test/functional/ex_cmds/highlight_spec.lua
+++ b/test/functional/ex_cmds/highlight_spec.lua
@@ -4,8 +4,8 @@ local eq, command = helpers.eq, helpers.command
local clear = helpers.clear
local eval, exc_exec = helpers.eval, helpers.exc_exec
local exec = helpers.exec
-local funcs = helpers.funcs
-local meths = helpers.meths
+local fn = helpers.fn
+local api = helpers.api
describe(':highlight', function()
local screen
@@ -53,18 +53,18 @@ describe(':highlight', function()
end)
it('clear', function()
- meths.nvim_set_var('colors_name', 'foo')
- eq(1, funcs.exists('g:colors_name'))
+ api.nvim_set_var('colors_name', 'foo')
+ eq(1, fn.exists('g:colors_name'))
command('hi clear')
- eq(0, funcs.exists('g:colors_name'))
- meths.nvim_set_var('colors_name', 'foo')
- eq(1, funcs.exists('g:colors_name'))
+ eq(0, fn.exists('g:colors_name'))
+ api.nvim_set_var('colors_name', 'foo')
+ eq(1, fn.exists('g:colors_name'))
exec([[
func HiClear()
hi clear
endfunc
]])
- funcs.HiClear()
- eq(0, funcs.exists('g:colors_name'))
+ fn.HiClear()
+ eq(0, fn.exists('g:colors_name'))
end)
end)
diff --git a/test/functional/ex_cmds/ls_spec.lua b/test/functional/ex_cmds/ls_spec.lua
index 0dac810ef7..5f59402d10 100644
--- a/test/functional/ex_cmds/ls_spec.lua
+++ b/test/functional/ex_cmds/ls_spec.lua
@@ -4,7 +4,7 @@ local command = helpers.command
local eq = helpers.eq
local eval = helpers.eval
local feed = helpers.feed
-local meths = helpers.meths
+local api = helpers.api
local testprg = helpers.testprg
local retry = helpers.retry
@@ -14,7 +14,7 @@ describe(':ls', function()
end)
it('R, F for :terminal buffers', function()
- meths.nvim_set_option_value('shell', string.format('"%s" INTERACT', testprg('shell-test')), {})
+ api.nvim_set_option_value('shell', string.format('"%s" INTERACT', testprg('shell-test')), {})
command('edit foo')
command('set hidden')
diff --git a/test/functional/ex_cmds/make_spec.lua b/test/functional/ex_cmds/make_spec.lua
index a91ee23bb8..dd47bdec58 100644
--- a/test/functional/ex_cmds/make_spec.lua
+++ b/test/functional/ex_cmds/make_spec.lua
@@ -3,7 +3,7 @@ local clear = helpers.clear
local eval = helpers.eval
local has_powershell = helpers.has_powershell
local matches = helpers.matches
-local meths = helpers.meths
+local api = helpers.api
local testprg = helpers.testprg
describe(':make', function()
@@ -22,7 +22,7 @@ describe(':make', function()
end)
it('captures stderr & non zero exit code #14349', function()
- meths.nvim_set_option_value('makeprg', testprg('shell-test') .. ' foo', {})
+ api.nvim_set_option_value('makeprg', testprg('shell-test') .. ' foo', {})
local out = eval('execute("make")')
-- Error message is captured in the file and printed in the footer
matches(
@@ -32,7 +32,7 @@ describe(':make', function()
end)
it('captures stderr & zero exit code #14349', function()
- meths.nvim_set_option_value('makeprg', testprg('shell-test'), {})
+ api.nvim_set_option_value('makeprg', testprg('shell-test'), {})
local out = eval('execute("make")')
-- Ensure there are no "shell returned X" messages between
-- command and last line (indicating zero exit)
diff --git a/test/functional/ex_cmds/map_spec.lua b/test/functional/ex_cmds/map_spec.lua
index 16df6f58b5..d3b027e6f4 100644
--- a/test/functional/ex_cmds/map_spec.lua
+++ b/test/functional/ex_cmds/map_spec.lua
@@ -5,7 +5,7 @@ local eq = helpers.eq
local exec = helpers.exec
local exec_capture = helpers.exec_capture
local feed = helpers.feed
-local meths = helpers.meths
+local api = helpers.api
local clear = helpers.clear
local command = helpers.command
local expect = helpers.expect
@@ -16,13 +16,13 @@ describe(':*map', function()
before_each(clear)
it('are not affected by &isident', function()
- meths.nvim_set_var('counter', 0)
+ api.nvim_set_var('counter', 0)
command('nnoremap <C-x> :let counter+=1<CR>')
- meths.nvim_set_option_value('isident', ('%u'):format(('>'):byte()), {})
+ api.nvim_set_option_value('isident', ('%u'):format(('>'):byte()), {})
command('nnoremap <C-y> :let counter+=1<CR>')
-- &isident used to disable keycode parsing here as well
feed('\24\25<C-x><C-y>')
- eq(4, meths.nvim_get_var('counter'))
+ eq(4, api.nvim_get_var('counter'))
end)
it(':imap <M-">', function()
@@ -42,9 +42,9 @@ n asdf <Nop>]],
end)
it('mappings with description can be filtered', function()
- meths.nvim_set_keymap('n', 'asdf1', 'qwert', { desc = 'do the one thing' })
- meths.nvim_set_keymap('n', 'asdf2', 'qwert', { desc = 'doesnot really do anything' })
- meths.nvim_set_keymap('n', 'asdf3', 'qwert', { desc = 'do the other thing' })
+ api.nvim_set_keymap('n', 'asdf1', 'qwert', { desc = 'do the one thing' })
+ api.nvim_set_keymap('n', 'asdf2', 'qwert', { desc = 'doesnot really do anything' })
+ api.nvim_set_keymap('n', 'asdf3', 'qwert', { desc = 'do the other thing' })
eq(
[[
@@ -58,21 +58,21 @@ n asdf1 qwert
it('<Plug> mappings ignore nore', function()
command('let x = 0')
- eq(0, meths.nvim_eval('x'))
+ eq(0, api.nvim_eval('x'))
command [[
nnoremap <Plug>(Increase_x) <cmd>let x+=1<cr>
nmap increase_x_remap <Plug>(Increase_x)
nnoremap increase_x_noremap <Plug>(Increase_x)
]]
feed('increase_x_remap')
- eq(1, meths.nvim_eval('x'))
+ eq(1, api.nvim_eval('x'))
feed('increase_x_noremap')
- eq(2, meths.nvim_eval('x'))
+ eq(2, api.nvim_eval('x'))
end)
it("Doesn't auto ignore nore for keys before or after <Plug> mapping", function()
command('let x = 0')
- eq(0, meths.nvim_eval('x'))
+ eq(0, api.nvim_eval('x'))
command [[
nnoremap x <nop>
nnoremap <Plug>(Increase_x) <cmd>let x+=1<cr>
@@ -83,10 +83,10 @@ n asdf1 qwert
eq('Some text', eval("getline('.')"))
feed('increase_x_remap')
- eq(1, meths.nvim_eval('x'))
+ eq(1, api.nvim_eval('x'))
eq('Some text', eval("getline('.')"))
feed('increase_x_noremap')
- eq(2, meths.nvim_eval('x'))
+ eq(2, api.nvim_eval('x'))
eq('Some te', eval("getline('.')"))
end)
diff --git a/test/functional/ex_cmds/menu_spec.lua b/test/functional/ex_cmds/menu_spec.lua
index cd5f4d870c..bb6ef72787 100644
--- a/test/functional/ex_cmds/menu_spec.lua
+++ b/test/functional/ex_cmds/menu_spec.lua
@@ -2,7 +2,7 @@ local helpers = require('test.functional.helpers')(after_each)
local clear, command = helpers.clear, helpers.command
local expect, feed = helpers.expect, helpers.feed
local eq, eval = helpers.eq, helpers.eval
-local funcs = helpers.funcs
+local fn = helpers.fn
describe(':emenu', function()
before_each(function()
@@ -80,7 +80,7 @@ describe('menu_get', function()
end)
it("path='', modes='a'", function()
- local m = funcs.menu_get('', 'a')
+ local m = fn.menu_get('', 'a')
-- HINT: To print the expected table and regenerate the tests:
-- print(require('vim.inspect')(m))
local expected = {
@@ -308,7 +308,7 @@ describe('menu_get', function()
end)
it('matching path, all modes', function()
- local m = funcs.menu_get('Export', 'a')
+ local m = fn.menu_get('Export', 'a')
local expected = {
{
hidden = 0,
@@ -337,7 +337,7 @@ describe('menu_get', function()
end)
it('no path, matching modes', function()
- local m = funcs.menu_get('', 'i')
+ local m = fn.menu_get('', 'i')
local expected = {
{
shortcut = 'T',
@@ -366,7 +366,7 @@ describe('menu_get', function()
end)
it('matching path and modes', function()
- local m = funcs.menu_get('Test', 'i')
+ local m = fn.menu_get('Test', 'i')
local expected = {
{
shortcut = 'T',
@@ -412,7 +412,7 @@ describe('menu_get', function()
command('nnoremenu &Test.Test8 <NoP>')
command('nnoremenu &Test.Test9 ""')
- local m = funcs.menu_get('')
+ local m = fn.menu_get('')
local expected = {
{
shortcut = 'T',
@@ -565,7 +565,7 @@ describe('menu_get', function()
command('nnoremenu &Test\\ 1.Test\\ 2 Wargl')
command('nnoremenu &Test4.Test<Tab>3 i space<Esc>')
- local m = funcs.menu_get('')
+ local m = fn.menu_get('')
local expected = {
{
shortcut = 'T',
diff --git a/test/functional/ex_cmds/mksession_spec.lua b/test/functional/ex_cmds/mksession_spec.lua
index 2a62bff6e9..16c608b156 100644
--- a/test/functional/ex_cmds/mksession_spec.lua
+++ b/test/functional/ex_cmds/mksession_spec.lua
@@ -6,12 +6,12 @@ local command = helpers.command
local get_pathsep = helpers.get_pathsep
local eq = helpers.eq
local neq = helpers.neq
-local funcs = helpers.funcs
+local fn = helpers.fn
local matches = helpers.matches
local pesc = vim.pesc
local rmdir = helpers.rmdir
local sleep = vim.uv.sleep
-local meths = helpers.meths
+local api = helpers.api
local skip = helpers.skip
local is_os = helpers.is_os
local mkdir = helpers.mkdir
@@ -54,8 +54,8 @@ describe(':mksession', function()
-- Restore session.
command('source ' .. session_file)
- eq(funcs.winbufnr(1), funcs.winbufnr(2))
- neq(funcs.winbufnr(1), funcs.winbufnr(3))
+ eq(fn.winbufnr(1), fn.winbufnr(2))
+ neq(fn.winbufnr(1), fn.winbufnr(3))
end)
-- common testing procedure for testing "sessionoptions-=terminal"
@@ -70,7 +70,7 @@ describe(':mksession', function()
-- Restore session.
command('source ' .. session_file)
- eq(expected_buf_count, #meths.nvim_list_bufs())
+ eq(expected_buf_count, #api.nvim_list_bufs())
end
it(
@@ -80,54 +80,54 @@ describe(':mksession', function()
command('edit ' .. tmpfile_base)
command('terminal')
- local buf_count = #meths.nvim_list_bufs()
+ local buf_count = #api.nvim_list_bufs()
eq(2, buf_count)
- eq('terminal', meths.nvim_get_option_value('buftype', {}))
+ eq('terminal', api.nvim_get_option_value('buftype', {}))
test_terminal_session_disabled(2)
-- no terminal should be set. As a side effect we end up with a blank buffer
- eq('', meths.nvim_get_option_value('buftype', { buf = meths.nvim_list_bufs()[1] }))
- eq('', meths.nvim_get_option_value('buftype', { buf = meths.nvim_list_bufs()[2] }))
+ eq('', api.nvim_get_option_value('buftype', { buf = api.nvim_list_bufs()[1] }))
+ eq('', api.nvim_get_option_value('buftype', { buf = api.nvim_list_bufs()[2] }))
end
)
it('do not restore :terminal if not set in sessionoptions, terminal hidden #13078', function()
command('terminal')
- local terminal_bufnr = meths.nvim_get_current_buf()
+ local terminal_bufnr = api.nvim_get_current_buf()
local tmpfile_base = file_prefix .. '-tmpfile'
-- make terminal hidden by opening a new file
command('edit ' .. tmpfile_base .. '1')
- local buf_count = #meths.nvim_list_bufs()
+ local buf_count = #api.nvim_list_bufs()
eq(2, buf_count)
- eq(1, funcs.getbufinfo(terminal_bufnr)[1].hidden)
+ eq(1, fn.getbufinfo(terminal_bufnr)[1].hidden)
test_terminal_session_disabled(1)
-- no terminal should exist here
- neq('', meths.nvim_buf_get_name(meths.nvim_list_bufs()[1]))
+ neq('', api.nvim_buf_get_name(api.nvim_list_bufs()[1]))
end)
it('do not restore :terminal if not set in sessionoptions, only buffer #13078', function()
command('terminal')
- eq('terminal', meths.nvim_get_option_value('buftype', {}))
+ eq('terminal', api.nvim_get_option_value('buftype', {}))
- local buf_count = #meths.nvim_list_bufs()
+ local buf_count = #api.nvim_list_bufs()
eq(1, buf_count)
test_terminal_session_disabled(1)
-- no terminal should be set
- eq('', meths.nvim_get_option_value('buftype', {}))
+ eq('', api.nvim_get_option_value('buftype', {}))
end)
it('restores tab-local working directories', function()
local tmpfile_base = file_prefix .. '-tmpfile'
- local cwd_dir = funcs.getcwd()
+ local cwd_dir = fn.getcwd()
-- :mksession does not save empty tabs, so create some buffers.
command('edit ' .. tmpfile_base .. '1')
@@ -143,15 +143,15 @@ describe(':mksession', function()
command('source ' .. session_file)
-- First tab should have the original working directory.
command('tabnext 1')
- eq(cwd_dir, funcs.getcwd())
+ eq(cwd_dir, fn.getcwd())
-- Second tab should have the tab-local working directory.
command('tabnext 2')
- eq(cwd_dir .. get_pathsep() .. tab_dir, funcs.getcwd())
+ eq(cwd_dir .. get_pathsep() .. tab_dir, fn.getcwd())
end)
it('restores buffers with tab-local CWD', function()
local tmpfile_base = file_prefix .. '-tmpfile'
- local cwd_dir = funcs.getcwd()
+ local cwd_dir = fn.getcwd()
local session_path = cwd_dir .. get_pathsep() .. session_file
command('edit ' .. tmpfile_base .. '1')
@@ -167,13 +167,13 @@ describe(':mksession', function()
-- Use :silent to avoid press-enter prompt due to long path
command('silent source ' .. session_path)
command('tabnext 1')
- eq(cwd_dir .. get_pathsep() .. tmpfile_base .. '1', funcs.expand('%:p'))
+ eq(cwd_dir .. get_pathsep() .. tmpfile_base .. '1', fn.expand('%:p'))
command('tabnext 2')
- eq(cwd_dir .. get_pathsep() .. tmpfile_base .. '2', funcs.expand('%:p'))
+ eq(cwd_dir .. get_pathsep() .. tmpfile_base .. '2', fn.expand('%:p'))
end)
it('restores CWD for :terminal buffers #11288', function()
- local cwd_dir = funcs.fnamemodify('.', ':p:~'):gsub([[[\/]*$]], '')
+ local cwd_dir = fn.fnamemodify('.', ':p:~'):gsub([[[\/]*$]], '')
cwd_dir = cwd_dir:gsub([[\]], '/') -- :mksession always uses unix slashes.
local session_path = cwd_dir .. '/' .. session_file
@@ -191,7 +191,7 @@ describe(':mksession', function()
command('silent source ' .. session_path)
local expected_cwd = cwd_dir .. '/' .. tab_dir
- matches('^term://' .. pesc(expected_cwd) .. '//%d+:', funcs.expand('%'))
+ matches('^term://' .. pesc(expected_cwd) .. '//%d+:', fn.expand('%'))
command('%bwipeout!')
if is_os('win') then
sleep(100) -- Make sure all child processes have exited.
@@ -202,7 +202,7 @@ describe(':mksession', function()
skip(is_os('win'), 'N/A for Windows')
local screen
- local cwd_dir = funcs.fnamemodify('.', ':p:~'):gsub([[[\/]*$]], '')
+ local cwd_dir = fn.fnamemodify('.', ':p:~'):gsub([[[\/]*$]], '')
local session_path = cwd_dir .. '/' .. session_file
screen = Screen.new(50, 6)
@@ -238,7 +238,7 @@ describe(':mksession', function()
local tmpfile = file_prefix .. '-tmpfile-float'
command('edit ' .. tmpfile)
- local buf = meths.nvim_create_buf(false, true)
+ local buf = api.nvim_create_buf(false, true)
local config = {
relative = 'editor',
focusable = false,
@@ -248,8 +248,8 @@ describe(':mksession', function()
col = 1,
style = 'minimal',
}
- meths.nvim_open_win(buf, false, config)
- local cmdheight = meths.nvim_get_option_value('cmdheight', {})
+ api.nvim_open_win(buf, false, config)
+ local cmdheight = api.nvim_get_option_value('cmdheight', {})
command('mksession ' .. session_file)
-- Create a new test instance of Nvim.
@@ -257,12 +257,12 @@ describe(':mksession', function()
command('source ' .. session_file)
- eq(tmpfile, funcs.expand('%'))
+ eq(tmpfile, fn.expand('%'))
-- Check that there is only a single window, which indicates the floating
-- window was not restored.
- eq(1, funcs.winnr('$'))
+ eq(1, fn.winnr('$'))
-- The command-line height should remain the same as it was.
- eq(cmdheight, meths.nvim_get_option_value('cmdheight', {}))
+ eq(cmdheight, api.nvim_get_option_value('cmdheight', {}))
os.remove(tmpfile)
end)
diff --git a/test/functional/ex_cmds/mkview_spec.lua b/test/functional/ex_cmds/mkview_spec.lua
index fa8da6e981..de0a4fe0ea 100644
--- a/test/functional/ex_cmds/mkview_spec.lua
+++ b/test/functional/ex_cmds/mkview_spec.lua
@@ -4,7 +4,7 @@ local clear = helpers.clear
local command = helpers.command
local get_pathsep = helpers.get_pathsep
local eq = helpers.eq
-local funcs = helpers.funcs
+local fn = helpers.fn
local rmdir = helpers.rmdir
local mkdir = helpers.mkdir
@@ -28,7 +28,7 @@ describe(':mkview', function()
end)
it('viewoption curdir restores local current directory', function()
- local cwd_dir = funcs.getcwd()
+ local cwd_dir = fn.getcwd()
local set_view_dir_command = 'set viewdir=' .. cwd_dir .. get_pathsep() .. view_dir
-- By default the local current directory should save
@@ -55,11 +55,11 @@ describe(':mkview', function()
command('edit ' .. tmp_file_base .. '2')
command('loadview')
-- The view's current directory should not have changed
- eq(cwd_dir, funcs.getcwd())
+ eq(cwd_dir, fn.getcwd())
-- Load the view with a saved local current directory
command('edit ' .. tmp_file_base .. '1')
command('loadview')
-- The view's local directory should have been saved
- eq(cwd_dir .. get_pathsep() .. local_dir, funcs.getcwd())
+ eq(cwd_dir .. get_pathsep() .. local_dir, fn.getcwd())
end)
end)
diff --git a/test/functional/ex_cmds/normal_spec.lua b/test/functional/ex_cmds/normal_spec.lua
index 009f1d6516..723bfefcf4 100644
--- a/test/functional/ex_cmds/normal_spec.lua
+++ b/test/functional/ex_cmds/normal_spec.lua
@@ -1,7 +1,7 @@
local helpers = require('test.functional.helpers')(after_each)
local clear = helpers.clear
local command = helpers.command
-local funcs = helpers.funcs
+local fn = helpers.fn
local feed = helpers.feed
local expect = helpers.expect
local eq = helpers.eq
@@ -29,10 +29,10 @@ describe(':normal!', function()
it('can stop Visual mode without closing cmdwin vim-patch:9.0.0234', function()
feed('q:')
feed('v')
- eq('v', funcs.mode(1))
- eq(':', funcs.getcmdwintype())
+ eq('v', fn.mode(1))
+ eq(':', fn.getcmdwintype())
command('normal! \027')
- eq('n', funcs.mode(1))
- eq(':', funcs.getcmdwintype())
+ eq('n', fn.mode(1))
+ eq(':', fn.getcmdwintype())
end)
end)
diff --git a/test/functional/ex_cmds/oldfiles_spec.lua b/test/functional/ex_cmds/oldfiles_spec.lua
index ee2bbdc4e7..8d1469f343 100644
--- a/test/functional/ex_cmds/oldfiles_spec.lua
+++ b/test/functional/ex_cmds/oldfiles_spec.lua
@@ -4,7 +4,7 @@ local helpers = require('test.functional.helpers')(after_each)
local clear = helpers.clear
local command = helpers.command
local expect_exit = helpers.expect_exit
-local meths, eq, feed_command = helpers.meths, helpers.eq, helpers.feed_command
+local api, eq, feed_command = helpers.api, helpers.eq, helpers.feed_command
local feed, poke_eventloop = helpers.feed, helpers.poke_eventloop
local ok = helpers.ok
local eval = helpers.eval
@@ -42,7 +42,7 @@ describe(':oldfiles', function()
feed_command('edit testfile2')
feed_command('wshada')
feed_command('rshada!')
- local oldfiles = meths.nvim_get_vvar('oldfiles')
+ local oldfiles = api.nvim_get_vvar('oldfiles')
feed_command('oldfiles')
screen:expect([[
|
@@ -56,11 +56,11 @@ describe(':oldfiles', function()
it('can be filtered with :filter', function()
feed_command('edit file_one.txt')
- local file1 = meths.nvim_buf_get_name(0)
+ local file1 = api.nvim_buf_get_name(0)
feed_command('edit file_two.txt')
- local file2 = meths.nvim_buf_get_name(0)
+ local file2 = api.nvim_buf_get_name(0)
feed_command('edit another.txt')
- local another = meths.nvim_buf_get_name(0)
+ local another = api.nvim_buf_get_name(0)
feed_command('wshada')
feed_command('rshada!')
@@ -95,9 +95,9 @@ describe(':browse oldfiles', function()
before_each(function()
_clear()
feed_command('edit testfile1')
- filename = meths.nvim_buf_get_name(0)
+ filename = api.nvim_buf_get_name(0)
feed_command('edit testfile2')
- filename2 = meths.nvim_buf_get_name(0)
+ filename2 = api.nvim_buf_get_name(0)
feed_command('wshada')
poke_eventloop()
_clear()
@@ -108,7 +108,7 @@ describe(':browse oldfiles', function()
-- Ensure v:oldfiles isn't busted. Since things happen so fast,
-- the ordering of v:oldfiles is unstable (it uses qsort() under-the-hood).
-- Let's verify the contents and the length of v:oldfiles before moving on.
- oldfiles = helpers.meths.nvim_get_vvar('oldfiles')
+ oldfiles = helpers.api.nvim_get_vvar('oldfiles')
eq(2, #oldfiles)
ok(filename == oldfiles[1] or filename == oldfiles[2])
ok(filename2 == oldfiles[1] or filename2 == oldfiles[2])
@@ -123,16 +123,16 @@ describe(':browse oldfiles', function()
it('provides a prompt and edits the chosen file', function()
feed('2<cr>')
- eq(oldfiles[2], meths.nvim_buf_get_name(0))
+ eq(oldfiles[2], api.nvim_buf_get_name(0))
end)
it('provides a prompt and does nothing on <cr>', function()
feed('<cr>')
- eq('', meths.nvim_buf_get_name(0))
+ eq('', api.nvim_buf_get_name(0))
end)
it('provides a prompt and does nothing if choice is out-of-bounds', function()
feed('3<cr>')
- eq('', meths.nvim_buf_get_name(0))
+ eq('', api.nvim_buf_get_name(0))
end)
end)
diff --git a/test/functional/ex_cmds/print_commands_spec.lua b/test/functional/ex_cmds/print_commands_spec.lua
index bcb3c437ed..ba5ec7d2d1 100644
--- a/test/functional/ex_cmds/print_commands_spec.lua
+++ b/test/functional/ex_cmds/print_commands_spec.lua
@@ -1,11 +1,11 @@
local helpers = require('test.functional.helpers')(after_each)
-local clear, eq, command, funcs = helpers.clear, helpers.eq, helpers.command, helpers.funcs
+local clear, eq, command, fn = helpers.clear, helpers.eq, helpers.command, helpers.fn
describe(':z^', function()
before_each(clear)
it('correctly sets the cursor after :z^', function()
command('z^')
- eq(1, funcs.line('.'))
+ eq(1, fn.line('.'))
end)
end)
diff --git a/test/functional/ex_cmds/quickfix_commands_spec.lua b/test/functional/ex_cmds/quickfix_commands_spec.lua
index 74283fcb4e..5af0198ffe 100644
--- a/test/functional/ex_cmds/quickfix_commands_spec.lua
+++ b/test/functional/ex_cmds/quickfix_commands_spec.lua
@@ -4,11 +4,11 @@ local Screen = require('test.functional.ui.screen')
local feed = helpers.feed
local eq = helpers.eq
local clear = helpers.clear
-local funcs = helpers.funcs
+local fn = helpers.fn
local command = helpers.command
local exc_exec = helpers.exc_exec
local write_file = helpers.write_file
-local meths = helpers.meths
+local api = helpers.api
local source = helpers.source
local file_base = 'Xtest-functional-ex_cmds-quickfix_commands'
@@ -20,8 +20,8 @@ for _, c in ipairs({ 'l', 'c' }) do
local filecmd = c .. 'file'
local getfcmd = c .. 'getfile'
local addfcmd = c .. 'addfile'
- local getlist = (c == 'c') and funcs.getqflist or function()
- return funcs.getloclist(0)
+ local getlist = (c == 'c') and fn.getqflist or function()
+ return fn.getloclist(0)
end
describe((':%s*file commands'):format(c), function()
@@ -73,13 +73,13 @@ for _, c in ipairs({ 'l', 'c' }) do
},
}
eq(list, getlist())
- eq(('%s-1.res'):format(file), funcs.bufname(list[1].bufnr))
- eq(('%s-2.res'):format(file), funcs.bufname(list[2].bufnr))
+ eq(('%s-1.res'):format(file), fn.bufname(list[1].bufnr))
+ eq(('%s-2.res'):format(file), fn.bufname(list[2].bufnr))
-- Run cfile/lfile from a modified buffer
command('set nohidden')
command('enew!')
- meths.nvim_buf_set_lines(0, 1, 1, true, { 'Quickfix' })
+ api.nvim_buf_set_lines(0, 1, 1, true, { 'Quickfix' })
eq(
('Vim(%s):E37: No write since last change (add ! to override)'):format(filecmd),
exc_exec(('%s %s'):format(filecmd, file))
@@ -107,7 +107,7 @@ for _, c in ipairs({ 'l', 'c' }) do
['type'] = '',
}
eq(list, getlist())
- eq(('%s-3.res'):format(file), funcs.bufname(list[3].bufnr))
+ eq(('%s-3.res'):format(file), fn.bufname(list[3].bufnr))
write_file(
file,
@@ -149,8 +149,8 @@ for _, c in ipairs({ 'l', 'c' }) do
},
}
eq(list, getlist())
- eq(('%s-1.res'):format(file), funcs.bufname(list[1].bufnr))
- eq(('%s-2.res'):format(file), funcs.bufname(list[2].bufnr))
+ eq(('%s-1.res'):format(file), fn.bufname(list[1].bufnr))
+ eq(('%s-2.res'):format(file), fn.bufname(list[2].bufnr))
end)
end)
end
@@ -178,7 +178,7 @@ describe('quickfix', function()
call append(0, ['New line 1', 'New line 2', 'New line 3'])
silent ll
]])
- eq({ 0, 6, 1, 0, 1 }, funcs.getcurpos())
+ eq({ 0, 6, 1, 0, 1 }, fn.getcurpos())
end)
it('BufAdd does not cause E16 when reusing quickfix buffer #18135', function()
diff --git a/test/functional/ex_cmds/script_spec.lua b/test/functional/ex_cmds/script_spec.lua
index 20fd65fc69..ebdaa0f656 100644
--- a/test/functional/ex_cmds/script_spec.lua
+++ b/test/functional/ex_cmds/script_spec.lua
@@ -5,7 +5,7 @@ local neq = helpers.neq
local command = helpers.command
local exec_capture = helpers.exec_capture
local write_file = helpers.write_file
-local meths = helpers.meths
+local api = helpers.api
local clear = helpers.clear
local dedent = helpers.dedent
local exc_exec = helpers.exc_exec
@@ -83,7 +83,7 @@ describe('script_get-based command', function()
]])):format(cmd, garbage)
)
)
- neq(0, meths.nvim_get_var('exc'))
+ neq(0, api.nvim_get_var('exc'))
end
end)
end)
diff --git a/test/functional/ex_cmds/sign_spec.lua b/test/functional/ex_cmds/sign_spec.lua
index a0783264a7..06de7f23a9 100644
--- a/test/functional/ex_cmds/sign_spec.lua
+++ b/test/functional/ex_cmds/sign_spec.lua
@@ -1,7 +1,7 @@
local helpers = require('test.functional.helpers')(after_each)
local clear, eq, assert_alive = helpers.clear, helpers.eq, helpers.assert_alive
local command = helpers.command
-local meths = helpers.meths
+local api = helpers.api
describe('sign', function()
before_each(clear)
@@ -10,16 +10,16 @@ describe('sign', function()
it('deletes the sign from all buffers', function()
-- place a sign with id 34 to first buffer
command('sign define Foo text=+ texthl=Delimiter linehl=Comment numhl=Number')
- local buf1 = meths.nvim_eval('bufnr("%")')
+ local buf1 = api.nvim_eval('bufnr("%")')
command('sign place 34 line=3 name=Foo buffer=' .. buf1)
-- create a second buffer and place the sign on it as well
command('new')
- local buf2 = meths.nvim_eval('bufnr("%")')
+ local buf2 = api.nvim_eval('bufnr("%")')
command('sign place 34 line=3 name=Foo buffer=' .. buf2)
-- now unplace without specifying a buffer
command('sign unplace 34')
- eq('--- Signs ---\n', meths.nvim_exec('sign place buffer=' .. buf1, true))
- eq('--- Signs ---\n', meths.nvim_exec('sign place buffer=' .. buf2, true))
+ eq('--- Signs ---\n', api.nvim_exec('sign place buffer=' .. buf1, true))
+ eq('--- Signs ---\n', api.nvim_exec('sign place buffer=' .. buf2, true))
end)
end)
end)
diff --git a/test/functional/ex_cmds/source_spec.lua b/test/functional/ex_cmds/source_spec.lua
index 765f5d4b05..5ce0e395bd 100644
--- a/test/functional/ex_cmds/source_spec.lua
+++ b/test/functional/ex_cmds/source_spec.lua
@@ -3,7 +3,7 @@ local command = helpers.command
local insert = helpers.insert
local eq = helpers.eq
local clear = helpers.clear
-local meths = helpers.meths
+local api = helpers.api
local feed = helpers.feed
local feed_command = helpers.feed_command
local write_file = helpers.write_file
@@ -49,7 +49,7 @@ describe(':source', function()
pending("'shellslash' only works on Windows")
return
end
- meths.nvim_set_option_value('shellslash', false, {})
+ api.nvim_set_option_value('shellslash', false, {})
mkdir('Xshellslash')
write_file(
@@ -65,9 +65,9 @@ describe(':source', function()
for _ = 1, 2 do
command([[source Xshellslash/Xstack.vim]])
- matches([[Xshellslash\Xstack%.vim]], meths.nvim_get_var('stack1'))
- matches([[Xshellslash/Xstack%.vim]], meths.nvim_get_var('stack2'))
- matches([[Xshellslash\Xstack%.vim]], meths.nvim_get_var('stack3'))
+ matches([[Xshellslash\Xstack%.vim]], api.nvim_get_var('stack1'))
+ matches([[Xshellslash/Xstack%.vim]], api.nvim_get_var('stack2'))
+ matches([[Xshellslash\Xstack%.vim]], api.nvim_get_var('stack3'))
end
write_file(
@@ -83,9 +83,9 @@ describe(':source', function()
for _ = 1, 2 do
command([[source Xshellslash/Xstack.lua]])
- matches([[Xshellslash\Xstack%.lua]], meths.nvim_get_var('stack1'))
- matches([[Xshellslash/Xstack%.lua]], meths.nvim_get_var('stack2'))
- matches([[Xshellslash\Xstack%.lua]], meths.nvim_get_var('stack3'))
+ matches([[Xshellslash\Xstack%.lua]], api.nvim_get_var('stack1'))
+ matches([[Xshellslash/Xstack%.lua]], api.nvim_get_var('stack2'))
+ matches([[Xshellslash\Xstack%.lua]], api.nvim_get_var('stack3'))
end
rmdir('Xshellslash')
@@ -182,9 +182,9 @@ describe(':source', function()
command('set shellslash')
command('source ' .. test_file)
eq(1, eval('g:sourced_lua'))
- matches([[/test%.lua$]], meths.nvim_get_var('sfile_value'))
- matches([[/test%.lua$]], meths.nvim_get_var('stack_value'))
- matches([[/test%.lua$]], meths.nvim_get_var('script_value'))
+ matches([[/test%.lua$]], api.nvim_get_var('sfile_value'))
+ matches([[/test%.lua$]], api.nvim_get_var('stack_value'))
+ matches([[/test%.lua$]], api.nvim_get_var('script_value'))
os.remove(test_file)
end)
@@ -229,9 +229,9 @@ describe(':source', function()
eq(12, eval('g:c'))
eq(' \\ 1\n "\\ 2', exec_lua('return _G.a'))
- eq(':source (no file)', meths.nvim_get_var('sfile_value'))
- eq(':source (no file)', meths.nvim_get_var('stack_value'))
- eq(':source (no file)', meths.nvim_get_var('script_value'))
+ eq(':source (no file)', api.nvim_get_var('sfile_value'))
+ eq(':source (no file)', api.nvim_get_var('stack_value'))
+ eq(':source (no file)', api.nvim_get_var('script_value'))
end)
end
diff --git a/test/functional/ex_cmds/swapfile_preserve_recover_spec.lua b/test/functional/ex_cmds/swapfile_preserve_recover_spec.lua
index 99191a2a57..4c2e54cc6b 100644
--- a/test/functional/ex_cmds/swapfile_preserve_recover_spec.lua
+++ b/test/functional/ex_cmds/swapfile_preserve_recover_spec.lua
@@ -6,7 +6,7 @@ local assert_alive = helpers.assert_alive
local clear = helpers.clear
local command = helpers.command
local feed = helpers.feed
-local funcs = helpers.funcs
+local fn = helpers.fn
local nvim_prog = helpers.nvim_prog
local ok = helpers.ok
local rmdir = helpers.rmdir
@@ -21,7 +21,7 @@ local expect_msg_seq = helpers.expect_msg_seq
local pcall_err = helpers.pcall_err
local mkdir = helpers.mkdir
local poke_eventloop = helpers.poke_eventloop
-local meths = helpers.meths
+local api = helpers.api
local retry = helpers.retry
local write_file = helpers.write_file
@@ -114,7 +114,7 @@ describe("preserve and (R)ecover with custom 'directory'", function()
local screen0 = Screen.new()
screen0:attach()
local child_server = new_pipename()
- funcs.termopen({ nvim_prog, '-u', 'NONE', '-i', 'NONE', '--listen', child_server }, {
+ fn.termopen({ nvim_prog, '-u', 'NONE', '-i', 'NONE', '--listen', child_server }, {
env = { VIMRUNTIME = os.getenv('VIMRUNTIME') },
})
screen0:expect({ any = pesc('[No Name]') }) -- Wait for the child process to start.
@@ -246,7 +246,7 @@ describe('swapfile detection', function()
command('edit Xfile1')
command("put ='some text...'")
command('preserve') -- Make sure the swap file exists.
- local nvimpid = funcs.getpid()
+ local nvimpid = fn.getpid()
local nvim1 = spawn(new_argv(), true, nil, true)
set_session(nvim1)
@@ -352,7 +352,7 @@ describe('swapfile detection', function()
edit Xswaptest
call setline(1, ['a', 'b', 'c'])
]])
- local swname = funcs.CopySwapfile()
+ local swname = fn.CopySwapfile()
-- Forget we edited this file
exec([[
@@ -438,7 +438,7 @@ describe('quitting swapfile dialog on startup stops TUI properly', function()
feed('Gisometext<esc>')
poke_eventloop()
clear() -- Leaves a swap file behind
- meths.nvim_ui_attach(80, 30, {})
+ api.nvim_ui_attach(80, 30, {})
end)
after_each(function()
rmdir(swapdir)
@@ -447,7 +447,7 @@ describe('quitting swapfile dialog on startup stops TUI properly', function()
end)
it('(Q)uit at first file argument', function()
- local chan = funcs.termopen(
+ local chan = fn.termopen(
{ nvim_prog, '-u', 'NONE', '-i', 'NONE', '--cmd', init_dir, '--cmd', init_set, testfile },
{
env = { VIMRUNTIME = os.getenv('VIMRUNTIME') },
@@ -459,7 +459,7 @@ describe('quitting swapfile dialog on startup stops TUI properly', function()
eval("getline('$')->trim(' ', 2)")
)
end)
- meths.nvim_chan_send(chan, 'q')
+ api.nvim_chan_send(chan, 'q')
retry(nil, nil, function()
eq(
{ '', '[Process exited 1]', '' },
@@ -469,7 +469,7 @@ describe('quitting swapfile dialog on startup stops TUI properly', function()
end)
it('(A)bort at second file argument with -p', function()
- local chan = funcs.termopen({
+ local chan = fn.termopen({
nvim_prog,
'-u',
'NONE',
@@ -491,7 +491,7 @@ describe('quitting swapfile dialog on startup stops TUI properly', function()
eval("getline('$')->trim(' ', 2)")
)
end)
- meths.nvim_chan_send(chan, 'a')
+ api.nvim_chan_send(chan, 'a')
retry(nil, nil, function()
eq(
{ '', '[Process exited 1]', '' },
@@ -509,7 +509,7 @@ describe('quitting swapfile dialog on startup stops TUI properly', function()
second %s /^ \zssecond$/
third %s /^ \zsthird$/]]):format(testfile, testfile, testfile)
)
- local chan = funcs.termopen({
+ local chan = fn.termopen({
nvim_prog,
'-u',
'NONE',
@@ -531,11 +531,11 @@ describe('quitting swapfile dialog on startup stops TUI properly', function()
eval("getline('$')->trim(' ', 2)")
)
end)
- meths.nvim_chan_send(chan, 'q')
+ api.nvim_chan_send(chan, 'q')
retry(nil, nil, function()
eq('Press ENTER or type command to continue', eval("getline('$')->trim(' ', 2)"))
end)
- meths.nvim_chan_send(chan, '\r')
+ api.nvim_chan_send(chan, '\r')
retry(nil, nil, function()
eq(
{ '', '[Process exited 1]', '' },
diff --git a/test/functional/ex_cmds/trust_spec.lua b/test/functional/ex_cmds/trust_spec.lua
index 953b25ba35..2997b504fa 100644
--- a/test/functional/ex_cmds/trust_spec.lua
+++ b/test/functional/ex_cmds/trust_spec.lua
@@ -7,7 +7,7 @@ local exec_capture = helpers.exec_capture
local matches = helpers.matches
local pathsep = helpers.get_pathsep()
local is_os = helpers.is_os
-local funcs = helpers.funcs
+local fn = helpers.fn
describe(':trust', function()
local xstate = 'Xstate'
@@ -30,53 +30,53 @@ describe(':trust', function()
end)
it('trust then deny then remove a file using current buffer', function()
- local cwd = funcs.getcwd()
- local hash = funcs.sha256(helpers.read_file('test_file'))
+ local cwd = fn.getcwd()
+ local hash = fn.sha256(helpers.read_file('test_file'))
command('edit test_file')
matches('^Allowed ".*test_file" in trust database%.$', exec_capture('trust'))
- local trust = helpers.read_file(funcs.stdpath('state') .. pathsep .. 'trust')
+ local trust = helpers.read_file(fn.stdpath('state') .. pathsep .. 'trust')
eq(string.format('%s %s', hash, cwd .. pathsep .. 'test_file'), vim.trim(trust))
matches('^Denied ".*test_file" in trust database%.$', exec_capture('trust ++deny'))
- trust = helpers.read_file(funcs.stdpath('state') .. pathsep .. 'trust')
+ trust = helpers.read_file(fn.stdpath('state') .. pathsep .. 'trust')
eq(string.format('! %s', cwd .. pathsep .. 'test_file'), vim.trim(trust))
matches('^Removed ".*test_file" from trust database%.$', exec_capture('trust ++remove'))
- trust = helpers.read_file(funcs.stdpath('state') .. pathsep .. 'trust')
+ trust = helpers.read_file(fn.stdpath('state') .. pathsep .. 'trust')
eq(string.format(''), vim.trim(trust))
end)
it('deny then trust then remove a file using current buffer', function()
- local cwd = funcs.getcwd()
- local hash = funcs.sha256(helpers.read_file('test_file'))
+ local cwd = fn.getcwd()
+ local hash = fn.sha256(helpers.read_file('test_file'))
command('edit test_file')
matches('^Denied ".*test_file" in trust database%.$', exec_capture('trust ++deny'))
- local trust = helpers.read_file(funcs.stdpath('state') .. pathsep .. 'trust')
+ local trust = helpers.read_file(fn.stdpath('state') .. pathsep .. 'trust')
eq(string.format('! %s', cwd .. pathsep .. 'test_file'), vim.trim(trust))
matches('^Allowed ".*test_file" in trust database%.$', exec_capture('trust'))
- trust = helpers.read_file(funcs.stdpath('state') .. pathsep .. 'trust')
+ trust = helpers.read_file(fn.stdpath('state') .. pathsep .. 'trust')
eq(string.format('%s %s', hash, cwd .. pathsep .. 'test_file'), vim.trim(trust))
matches('^Removed ".*test_file" from trust database%.$', exec_capture('trust ++remove'))
- trust = helpers.read_file(funcs.stdpath('state') .. pathsep .. 'trust')
+ trust = helpers.read_file(fn.stdpath('state') .. pathsep .. 'trust')
eq(string.format(''), vim.trim(trust))
end)
it('deny then remove a file using file path', function()
- local cwd = funcs.getcwd()
+ local cwd = fn.getcwd()
matches('^Denied ".*test_file" in trust database%.$', exec_capture('trust ++deny test_file'))
- local trust = helpers.read_file(funcs.stdpath('state') .. pathsep .. 'trust')
+ local trust = helpers.read_file(fn.stdpath('state') .. pathsep .. 'trust')
eq(string.format('! %s', cwd .. pathsep .. 'test_file'), vim.trim(trust))
matches(
'^Removed ".*test_file" from trust database%.$',
exec_capture('trust ++remove test_file')
)
- trust = helpers.read_file(funcs.stdpath('state') .. pathsep .. 'trust')
+ trust = helpers.read_file(fn.stdpath('state') .. pathsep .. 'trust')
eq(string.format(''), vim.trim(trust))
end)
end)
diff --git a/test/functional/ex_cmds/verbose_spec.lua b/test/functional/ex_cmds/verbose_spec.lua
index dbc81cf5d8..7ceb2460d3 100644
--- a/test/functional/ex_cmds/verbose_spec.lua
+++ b/test/functional/ex_cmds/verbose_spec.lua
@@ -5,7 +5,7 @@ local eq = helpers.eq
local exec = helpers.exec
local exec_capture = helpers.exec_capture
local write_file = helpers.write_file
-local call_viml_function = helpers.meths.nvim_call_function
+local call_viml_function = helpers.api.nvim_call_function
local function last_set_tests(cmd)
local script_location, script_file
diff --git a/test/functional/ex_cmds/wincmd_spec.lua b/test/functional/ex_cmds/wincmd_spec.lua
index 1948cf017a..98c6358f45 100644
--- a/test/functional/ex_cmds/wincmd_spec.lua
+++ b/test/functional/ex_cmds/wincmd_spec.lua
@@ -1,13 +1,13 @@
local helpers = require('test.functional.helpers')(after_each)
local clear = helpers.clear
local eq = helpers.eq
-local funcs = helpers.funcs
+local fn = helpers.fn
local command = helpers.command
it(':wincmd accepts a count', function()
clear()
command('vsplit')
- eq(1, funcs.winnr())
+ eq(1, fn.winnr())
command('wincmd 2 w')
- eq(2, funcs.winnr())
+ eq(2, fn.winnr())
end)
diff --git a/test/functional/ex_cmds/write_spec.lua b/test/functional/ex_cmds/write_spec.lua
index 403e3426f9..f711731072 100644
--- a/test/functional/ex_cmds/write_spec.lua
+++ b/test/functional/ex_cmds/write_spec.lua
@@ -4,8 +4,8 @@ local eq, eval, clear, write_file, source, insert =
local pcall_err = helpers.pcall_err
local command = helpers.command
local feed_command = helpers.feed_command
-local funcs = helpers.funcs
-local meths = helpers.meths
+local fn = helpers.fn
+local api = helpers.api
local skip = helpers.skip
local is_os = helpers.is_os
local is_ci = helpers.is_ci
@@ -112,11 +112,11 @@ describe(':write', function()
eq('Vim(write):E32: No file name', pcall_err(command, 'write ++p test_write/'))
if not is_os('win') then
eq(
- ('Vim(write):E17: "' .. funcs.fnamemodify('.', ':p:h') .. '" is a directory'),
+ ('Vim(write):E17: "' .. fn.fnamemodify('.', ':p:h') .. '" is a directory'),
pcall_err(command, 'write ++p .')
)
eq(
- ('Vim(write):E17: "' .. funcs.fnamemodify('.', ':p:h') .. '" is a directory'),
+ ('Vim(write):E17: "' .. fn.fnamemodify('.', ':p:h') .. '" is a directory'),
pcall_err(command, 'write ++p ./')
)
end
@@ -125,26 +125,26 @@ describe(':write', function()
it('errors out correctly', function()
skip(is_ci('cirrus'))
command('let $HOME=""')
- eq(funcs.fnamemodify('.', ':p:h'), funcs.fnamemodify('.', ':p:h:~'))
+ eq(fn.fnamemodify('.', ':p:h'), fn.fnamemodify('.', ':p:h:~'))
-- Message from check_overwrite
if not is_os('win') then
eq(
- ('Vim(write):E17: "' .. funcs.fnamemodify('.', ':p:h') .. '" is a directory'),
+ ('Vim(write):E17: "' .. fn.fnamemodify('.', ':p:h') .. '" is a directory'),
pcall_err(command, 'write .')
)
end
- meths.nvim_set_option_value('writeany', true, {})
+ api.nvim_set_option_value('writeany', true, {})
-- Message from buf_write
eq('Vim(write):E502: "." is a directory', pcall_err(command, 'write .'))
- funcs.mkdir(fname_bak)
- meths.nvim_set_option_value('backupdir', '.', {})
- meths.nvim_set_option_value('backup', true, {})
+ fn.mkdir(fname_bak)
+ api.nvim_set_option_value('backupdir', '.', {})
+ api.nvim_set_option_value('backup', true, {})
write_file(fname, 'content0')
command('edit ' .. fname)
- funcs.setline(1, 'TTY')
+ fn.setline(1, 'TTY')
eq("Vim(write):E510: Can't make backup file (add ! to override)", pcall_err(command, 'write'))
- meths.nvim_set_option_value('backup', false, {})
- funcs.setfperm(fname, 'r--------')
+ api.nvim_set_option_value('backup', false, {})
+ fn.setfperm(fname, 'r--------')
eq(
'Vim(write):E505: "Xtest-functional-ex_cmds-write" is read-only (add ! to override)',
pcall_err(command, 'write')