From 4ceca862fceb021049144a9aed05c60ae39b7aba Mon Sep 17 00:00:00 2001 From: "Justin M. Keyes" Date: Mon, 20 Apr 2026 14:16:41 -0400 Subject: refactor(test): drop deprecated exc_exec #39242 --- test/functional/vimscript/api_functions_spec.lua | 23 ++++++++++++----------- 1 file changed, 12 insertions(+), 11 deletions(-) (limited to 'test/functional/vimscript/api_functions_spec.lua') 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) -- cgit