aboutsummaryrefslogtreecommitdiff
path: root/test/functional/vimscript/api_functions_spec.lua
diff options
context:
space:
mode:
authorJustin M. Keyes <justinkz@gmail.com>2026-04-20 14:16:41 -0400
committerGitHub <noreply@github.com>2026-04-20 14:16:41 -0400
commit4ceca862fceb021049144a9aed05c60ae39b7aba (patch)
treeb7b1f1e421aeeaa2d30a348745c17f9f9b69b8d7 /test/functional/vimscript/api_functions_spec.lua
parentfaa7c15b5a711435ed9d90f7fbf2a2ff8f1255c7 (diff)
downloadrneovim-4ceca862fceb021049144a9aed05c60ae39b7aba.tar.gz
rneovim-4ceca862fceb021049144a9aed05c60ae39b7aba.tar.bz2
rneovim-4ceca862fceb021049144a9aed05c60ae39b7aba.zip
refactor(test): drop deprecated exc_exec #39242
Diffstat (limited to 'test/functional/vimscript/api_functions_spec.lua')
-rw-r--r--test/functional/vimscript/api_functions_spec.lua23
1 files changed, 12 insertions, 11 deletions
diff --git a/test/functional/vimscript/api_functions_spec.lua b/test/functional/vimscript/api_functions_spec.lua
index efb72de8ca..b36acbd312 100644
--- a/test/functional/vimscript/api_functions_spec.lua
+++ b/test/functional/vimscript/api_functions_spec.lua
@@ -4,12 +4,13 @@ local Screen = require('test.functional.ui.screen')
local neq, eq, command = t.neq, t.eq, n.command
local clear = n.clear
-local exc_exec, expect, eval = n.exc_exec, n.expect, n.eval
+local expect, eval = n.expect, n.eval
local exec_lua = n.exec_lua
local insert, pcall_err = n.insert, t.pcall_err
local matches = t.matches
local api = n.api
local feed = n.feed
+local command = n.command
describe('eval-API', function()
before_each(clear)
@@ -32,31 +33,31 @@ describe('eval-API', function()
end)
it('throw errors for invalid arguments', function()
- local err = exc_exec('call nvim_get_current_buf("foo")')
+ local err = pcall_err(command, 'call nvim_get_current_buf("foo")')
eq('Vim(call):E118: Too many arguments for function: nvim_get_current_buf', err)
- err = exc_exec('call nvim_set_option_value("hlsearch")')
+ err = pcall_err(command, 'call nvim_set_option_value("hlsearch")')
eq('Vim(call):E119: Not enough arguments for function: nvim_set_option_value', err)
- err = exc_exec('call nvim_buf_set_lines(1, 0, -1, [], ["list"])')
+ err = pcall_err(command, 'call nvim_buf_set_lines(1, 0, -1, [], ["list"])')
eq(
'Vim(call):E5555: API call: Wrong type for argument 4 when calling nvim_buf_set_lines, expecting Boolean',
err
)
- err = exc_exec('call nvim_buf_set_lines(0, 0, -1, v:true, "string")')
+ err = pcall_err(command, 'call nvim_buf_set_lines(0, 0, -1, v:true, "string")')
eq(
'Vim(call):E5555: API call: Wrong type for argument 5 when calling nvim_buf_set_lines, expecting ArrayOf(String)',
err
)
- err = exc_exec('call nvim_buf_get_number("0")')
+ err = pcall_err(command, 'call nvim_buf_get_number("0")')
eq(
'Vim(call):E5555: API call: Wrong type for argument 1 when calling nvim_buf_get_number, expecting Buffer',
err
)
- err = exc_exec('call nvim_buf_line_count(17)')
+ err = pcall_err(command, 'call nvim_buf_line_count(17)')
eq('Vim(call):E5555: API call: Invalid buffer id: 17', err)
end)
@@ -166,20 +167,20 @@ describe('eval-API', function()
it('that are FUNC_ATTR_NOEVAL cannot be called', function()
-- Deprecated vim_ prefix is not exported.
- local err = exc_exec('call vim_get_current_buffer("foo")')
+ local err = pcall_err(command, 'call vim_get_current_buffer("foo")')
eq('Vim(call):E117: Unknown function: vim_get_current_buffer', err)
-- Deprecated buffer_ prefix is not exported.
- err = exc_exec('call buffer_line_count(0)')
+ err = pcall_err(command, 'call buffer_line_count(0)')
eq('Vim(call):E117: Unknown function: buffer_line_count', err)
-- Functions deprecated before the api functions became available
-- in vimscript are not exported.
- err = exc_exec('call buffer_get_line(0, 1)')
+ err = pcall_err(command, 'call buffer_get_line(0, 1)')
eq('Vim(call):E117: Unknown function: buffer_get_line', err)
-- some api functions are only useful from a msgpack-rpc channel
- err = exc_exec('call nvim_set_client_info()')
+ err = pcall_err(command, 'call nvim_set_client_info()')
eq('Vim(call):E117: Unknown function: nvim_set_client_info', err)
end)