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,6 +4,7 @@ local Screen = require('test.functional.ui.screen')
local t_lsp = require('test.functional.plugin.lsp.testutil')
local eq = t.eq
local pcall_err = t.pcall_err
local dedent = t.dedent
local exec_lua = n.exec_lua
local insert = n.insert

View File

@@ -4,9 +4,9 @@ local n = require('test.functional.testnvim')()
local clear = n.clear
local api = n.api
local eq = t.eq
local pcall_err = t.pcall_err
local nvim_eval = n.eval
local nvim_command = n.command
local exc_exec = n.exc_exec
local ok = t.ok
local NIL = vim.NIL
@@ -674,39 +674,63 @@ describe('autoload/msgpack.vim', function()
end)
it('errors out when needed', function()
eq('empty:Parsed string is empty', exc_exec('call msgpack#eval("", {})'))
eq('unknown:Invalid non-space character: ^', exc_exec('call msgpack#eval("^", {})'))
eq(
"char-invalid:Invalid integer character literal format: ''",
exc_exec('call msgpack#eval("\'\'", {})')
t.matches(
'empty:Parsed string is empty',
pcall_err(nvim_command, 'call msgpack#eval("", {})')
)
eq(
"char-invalid:Invalid integer character literal format: 'ab'",
exc_exec('call msgpack#eval("\'ab\'", {})')
t.matches(
'unknown:Invalid non%-space character: %^',
pcall_err(nvim_command, 'call msgpack#eval("^", {})')
)
eq(
"char-invalid:Invalid integer character literal format: '",
exc_exec('call msgpack#eval("\'", {})')
t.matches(
"char%-invalid:Invalid integer character literal format: ''",
pcall_err(nvim_command, 'call msgpack#eval("\'\'", {})')
)
eq('"-invalid:Invalid string: "', exc_exec('call msgpack#eval("\\"", {})'))
eq('"-invalid:Invalid string: ="', exc_exec('call msgpack#eval("=\\"", {})'))
eq('"-invalid:Invalid string: +(0)"', exc_exec('call msgpack#eval("+(0)\\"", {})'))
eq(
'0.-nodigits:Decimal dot must be followed by digit(s): .e1',
exc_exec('call msgpack#eval("0.e1", {})')
t.matches(
"char%-invalid:Invalid integer character literal format: 'ab'",
pcall_err(nvim_command, 'call msgpack#eval("\'ab\'", {})')
)
eq(
'0x-long:Must have at most 16 hex digits: FEDCBA98765432100',
exc_exec('call msgpack#eval("0xFEDCBA98765432100", {})')
t.matches(
"char%-invalid:Invalid integer character literal format: '",
pcall_err(nvim_command, 'call msgpack#eval("\'", {})')
)
t.matches(
'"%-invalid:Invalid string: "',
pcall_err(nvim_command, 'call msgpack#eval("\\"", {})')
)
t.matches(
'"%-invalid:Invalid string: ="',
pcall_err(nvim_command, 'call msgpack#eval("=\\"", {})')
)
t.matches(
'"%-invalid:Invalid string: %+%(0%)"',
pcall_err(nvim_command, 'call msgpack#eval("+(0)\\"", {})')
)
t.matches(
'0%.%-nodigits:Decimal dot must be followed by digit%(s%): %.e1',
pcall_err(nvim_command, 'call msgpack#eval("0.e1", {})')
)
t.matches(
'0x%-long:Must have at most 16 hex digits: FEDCBA98765432100',
pcall_err(nvim_command, 'call msgpack#eval("0xFEDCBA98765432100", {})')
)
t.matches(
'0x%-empty:Must have number after 0x: ',
pcall_err(nvim_command, 'call msgpack#eval("0x", {})')
)
t.matches(
'name%-unknown:Unknown name FOO: FOO',
pcall_err(nvim_command, 'call msgpack#eval("FOO", {})')
)
eq('0x-empty:Must have number after 0x: ', exc_exec('call msgpack#eval("0x", {})'))
eq('name-unknown:Unknown name FOO: FOO', exc_exec('call msgpack#eval("FOO", {})'))
eq(
'name-unknown:Unknown name py3: py3 print(sys.version_info)',
exc_exec('call msgpack#eval("py3 print(sys.version_info)", {})')
t.matches(
'name%-unknown:Unknown name py3: py3 print%(sys%.version_info%)',
pcall_err(nvim_command, 'call msgpack#eval("py3 print(sys.version_info)", {})')
)
t.matches(
'name%-unknown:Unknown name o: o',
pcall_err(nvim_command, 'call msgpack#eval("-info", {})')
)
eq('name-unknown:Unknown name o: o', exc_exec('call msgpack#eval("-info", {})'))
end)
end)
end)

View File

@@ -4,9 +4,9 @@ local Screen = require('test.functional.ui.screen')
local t_shada = require('test.functional.shada.testutil')
local clear = n.clear
local eq, api, nvim_eval, nvim_command, exc_exec, fn, nvim_feed =
t.eq, n.api, n.eval, n.command, n.exc_exec, n.fn, n.feed
local eq, api, nvim_eval, nvim_command, fn, nvim_feed = t.eq, n.api, n.eval, n.command, n.fn, n.feed
local neq = t.neq
local pcall_err = t.pcall_err
local read_file = t.read_file
local get_shada_rw = t_shada.get_shada_rw
@@ -92,25 +92,28 @@ describe('autoload/shada.vim', function()
{ type = 1, timestamp = 5, length = 1, data = 7 },
{ type = 1, timestamp = 10, length = 1, data = 5 },
}, nvim_eval(mpack2sd('[1, 5, 1, 7, 1, 10, 1, 5]')))
eq(
'zero-uint:Entry 1 has type element which is zero',
exc_exec('call ' .. mpack2sd('[0, 5, 1, 7]'))
t.matches(
'zero%-uint:Entry 1 has type element which is zero',
pcall_err(nvim_command, 'call ' .. mpack2sd('[0, 5, 1, 7]'))
)
eq(
'zero-uint:Entry 1 has type element which is zero',
exc_exec('call ' .. mpack2sd(('[%s, 5, 1, 7]'):format(sp('integer', '[1, 0, 0, 0]'))))
t.matches(
'zero%-uint:Entry 1 has type element which is zero',
pcall_err(
nvim_command,
'call ' .. mpack2sd(('[%s, 5, 1, 7]'):format(sp('integer', '[1, 0, 0, 0]')))
)
)
eq(
'not-uint:Entry 1 has timestamp element which is not an unsigned integer',
exc_exec('call ' .. mpack2sd('[1, -1, 1, 7]'))
t.matches(
'not%-uint:Entry 1 has timestamp element which is not an unsigned integer',
pcall_err(nvim_command, 'call ' .. mpack2sd('[1, -1, 1, 7]'))
)
eq(
'not-uint:Entry 1 has length element which is not an unsigned integer',
exc_exec('call ' .. mpack2sd('[1, 1, -1, 7]'))
t.matches(
'not%-uint:Entry 1 has length element which is not an unsigned integer',
pcall_err(nvim_command, 'call ' .. mpack2sd('[1, 1, -1, 7]'))
)
eq(
'not-uint:Entry 1 has type element which is not an unsigned integer',
exc_exec('call ' .. mpack2sd('["", 1, -1, 7]'))
t.matches(
'not%-uint:Entry 1 has type element which is not an unsigned integer',
pcall_err(nvim_command, 'call ' .. mpack2sd('["", 1, -1, 7]'))
)
end)
end)
@@ -2941,8 +2944,8 @@ describe('plugin/shada.vim', function()
end)
wshada('\004\000\006\146\000\196\002ab')
wshada_tmp('\004\001\006\146\000\196\002bc')
eq(0, exc_exec('source ' .. fname))
eq(0, exc_exec('source ' .. fname_tmp))
nvim_command('source ' .. fname)
nvim_command('source ' .. fname_tmp)
eq('bc', fn.histget(':', -1))
eq('ab', fn.histget(':', -2))
end)