refactor(test): drop deprecated exc_exec #39242

This commit is contained in:
Justin M. Keyes
2026-04-20 14:16:41 -04:00
committed by GitHub
parent faa7c15b5a
commit 4ceca862fc
77 changed files with 1009 additions and 799 deletions

View File

@@ -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)