mirror of
https://github.com/neovim/neovim.git
synced 2026-05-24 05:40:08 +00:00
refactor(test): drop deprecated exc_exec #39242
This commit is contained in:
@@ -14,10 +14,10 @@ local n = require('test.functional.testnvim')()
|
||||
local Screen = require('test.functional.ui.screen')
|
||||
|
||||
local mkdir = t.mkdir
|
||||
local pcall_err = t.pcall_err
|
||||
local clear = n.clear
|
||||
local eq = t.eq
|
||||
local exec = n.exec
|
||||
local exc_exec = n.exc_exec
|
||||
local exec_lua = n.exec_lua
|
||||
local exec_capture = n.exec_capture
|
||||
local eval = n.eval
|
||||
@@ -42,7 +42,8 @@ describe('Up to MAX_FUNC_ARGS arguments are handled by', function()
|
||||
local rep = n.fn['repeat']
|
||||
local expected = '2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,'
|
||||
eq(expected, printf(rep('%d,', max_func_args - 1), unpack(range(2, max_func_args))))
|
||||
local ret = exc_exec('call printf("", 2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21)')
|
||||
local ret =
|
||||
pcall_err(command, 'call printf("", 2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21)')
|
||||
eq('Vim(call):E740: Too many arguments for function printf', ret)
|
||||
end)
|
||||
|
||||
@@ -50,7 +51,10 @@ describe('Up to MAX_FUNC_ARGS arguments are handled by', function()
|
||||
local rpcnotify = n.fn.rpcnotify
|
||||
local ret = rpcnotify(0, 'foo', unpack(range(3, max_func_args)))
|
||||
eq(1, ret)
|
||||
ret = exc_exec('call rpcnotify(0, "foo", 3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21)')
|
||||
ret = pcall_err(
|
||||
command,
|
||||
'call rpcnotify(0, "foo", 3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21)'
|
||||
)
|
||||
eq('Vim(call):E740: Too many arguments for function rpcnotify', ret)
|
||||
end)
|
||||
end)
|
||||
@@ -158,7 +162,7 @@ describe('uncaught exception', function()
|
||||
|
||||
it('is not forgotten #13490', function()
|
||||
command('autocmd BufWinEnter * throw "i am error"')
|
||||
eq('i am error', exc_exec('try | new | endtry'))
|
||||
t.matches('i am error', pcall_err(command, 'try | new | endtry'))
|
||||
|
||||
-- Like Vim, throwing here aborts the processing of the script, but does not stop :runtime!
|
||||
-- from processing the others.
|
||||
@@ -180,7 +184,7 @@ describe('uncaught exception', function()
|
||||
end)
|
||||
|
||||
command('set runtimepath+=. | let result = ""')
|
||||
eq('throw1', exc_exec('try | runtime! throw*.vim | endtry'))
|
||||
t.matches('throw1', pcall_err(command, 'try | runtime! throw*.vim | endtry'))
|
||||
eq('123', eval('result'))
|
||||
end)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user