diff options
| author | Justin M. Keyes <justinkz@gmail.com> | 2026-04-20 14:16:41 -0400 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2026-04-20 14:16:41 -0400 |
| commit | 4ceca862fceb021049144a9aed05c60ae39b7aba (patch) | |
| tree | b7b1f1e421aeeaa2d30a348745c17f9f9b69b8d7 /test/functional/vimscript/buf_functions_spec.lua | |
| parent | faa7c15b5a711435ed9d90f7fbf2a2ff8f1255c7 (diff) | |
refactor(test): drop deprecated exc_exec #39242
Diffstat (limited to 'test/functional/vimscript/buf_functions_spec.lua')
| -rw-r--r-- | test/functional/vimscript/buf_functions_spec.lua | 25 |
1 files changed, 12 insertions, 13 deletions
diff --git a/test/functional/vimscript/buf_functions_spec.lua b/test/functional/vimscript/buf_functions_spec.lua index 625fbe7e03..c73f4b5197 100644 --- a/test/functional/vimscript/buf_functions_spec.lua +++ b/test/functional/vimscript/buf_functions_spec.lua @@ -6,7 +6,6 @@ local clear = n.clear local fn = n.fn local api = n.api local command = n.command -local exc_exec = n.exc_exec local get_pathsep = n.get_pathsep local rmdir = n.rmdir local pcall_err = t.pcall_err @@ -34,30 +33,30 @@ for _, func in ipairs({ for _, var in ipairs({ 'v:true', 'v:false' }) do eq( 'Vim(call):E5299: Expected a Number or a String, Boolean found', - exc_exec('call ' .. func:format(var)) + pcall_err(command, 'call ' .. func:format(var)) ) end eq( 'Vim(call):E5300: Expected a Number or a String', - exc_exec('call ' .. func:format('v:null')) + pcall_err(command, 'call ' .. func:format('v:null')) ) end) it('errors out when receives invalid argument', function() eq( 'Vim(call):E745: Expected a Number or a String, List found', - exc_exec('call ' .. func:format('[]')) + pcall_err(command, 'call ' .. func:format('[]')) ) eq( 'Vim(call):E728: Expected a Number or a String, Dictionary found', - exc_exec('call ' .. func:format('{}')) + pcall_err(command, 'call ' .. func:format('{}')) ) eq( 'Vim(call):E805: Expected a Number or a String, Float found', - exc_exec('call ' .. func:format('0.0')) + pcall_err(command, 'call ' .. func:format('0.0')) ) eq( 'Vim(call):E703: Expected a Number or a String, Funcref found', - exc_exec('call ' .. func:format('function("tr")')) + pcall_err(command, 'call ' .. func:format('function("tr")')) ) end) end) @@ -267,17 +266,17 @@ end) describe('setbufvar() function', function() it('throws the error or ignores the input when buffer was not found', function() command('file ' .. fname) - eq(0, exc_exec('call setbufvar(2, "&autoindent", 0)')) + command('call setbufvar(2, "&autoindent", 0)') eq( 'Vim(call):E94: No matching buffer for non-existent-buffer', - exc_exec('call setbufvar("non-existent-buffer", "&autoindent", 0)') + pcall_err(command, 'call setbufvar("non-existent-buffer", "&autoindent", 0)') ) - eq(0, exc_exec('call setbufvar("#", "&autoindent", 0)')) + command('call setbufvar("#", "&autoindent", 0)') command('edit ' .. fname2) eq(2, fn.bufnr('%')) eq( 'Vim(call):E93: More than one match for X', - exc_exec('call setbufvar("X", "&autoindent", 0)') + pcall_err(command, 'call setbufvar("X", "&autoindent", 0)') ) end) it('may set options, including window-local and global values', function() @@ -300,7 +299,7 @@ describe('setbufvar() function', function() eq(false, api.nvim_get_option_value('autoindent', { buf = buf1 })) fn.setbufvar(1, '&autoindent', true) eq(true, api.nvim_get_option_value('autoindent', { buf = buf1 })) - eq('Vim(call):E355: Unknown option: xxx', exc_exec('call setbufvar(1, "&xxx", 0)')) + eq('Vim(call):E355: Unknown option: xxx', pcall_err(command, 'call setbufvar(1, "&xxx", 0)')) end) it('may set variables', function() local buf1 = api.nvim_get_current_buf() @@ -309,7 +308,7 @@ describe('setbufvar() function', function() eq(2, api.nvim_buf_get_number(0)) fn.setbufvar(1, 'number', true) eq(true, api.nvim_buf_get_var(buf1, 'number')) - eq('Vim(call):E461: Illegal variable name: b:', exc_exec('call setbufvar(1, "", 0)')) + eq('Vim(call):E461: Illegal variable name: b:', pcall_err(command, 'call setbufvar(1, "", 0)')) eq(true, api.nvim_buf_get_var(buf1, 'number')) eq( 'Vim:E46: Cannot change read-only variable "b:changedtick"', |
