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/lua/luaeval_spec.lua | |
| parent | faa7c15b5a711435ed9d90f7fbf2a2ff8f1255c7 (diff) | |
refactor(test): drop deprecated exc_exec #39242
Diffstat (limited to 'test/functional/lua/luaeval_spec.lua')
| -rw-r--r-- | test/functional/lua/luaeval_spec.lua | 30 |
1 files changed, 19 insertions, 11 deletions
diff --git a/test/functional/lua/luaeval_spec.lua b/test/functional/lua/luaeval_spec.lua index 199fda6ca1..1eb8cf9958 100644 --- a/test/functional/lua/luaeval_spec.lua +++ b/test/functional/lua/luaeval_spec.lua @@ -4,7 +4,6 @@ local n = require('test.functional.testnvim')() local Screen = require('test.functional.ui.screen') local pcall_err = t.pcall_err -local exc_exec = n.exc_exec local remove_trace = t.remove_trace local exec_lua = n.exec_lua local command = n.command @@ -198,11 +197,17 @@ describe('luaeval()', function() it('failure modes', function() eq( 'Vim(call):E5100: Cannot convert given Lua table: table should contain either only integer keys or only string keys', - exc_exec('call luaeval("{1, foo=2}")') + pcall_err(command, 'call luaeval("{1, foo=2}")') ) - startswith('Vim(call):E5107: Lua: [string "luaeval()"]:', exc_exec('call luaeval("1, 2, 3")')) - startswith('Vim(call):E5108: Lua: [string "luaeval()"]:', exc_exec('call luaeval("(nil)()")')) + startswith( + 'Vim(call):E5107: Lua: [string "luaeval()"]:', + pcall_err(command, 'call luaeval("1, 2, 3")') + ) + startswith( + 'Vim(call):E5108: Lua: [string "luaeval()"]:', + pcall_err(command, 'call luaeval("(nil)()")') + ) end) it('handles sending lua functions to viml', function() @@ -482,21 +487,24 @@ describe('luaeval()', function() it('fails when doing incorrect things in lua', function() -- Conversion errors eq( - 'Vim(call):E5108: Lua: [string "luaeval()"]:1: attempt to call field \'xxx_nonexistent_key_xxx\' (a nil value)', - remove_trace(exc_exec([[call luaeval("vim.xxx_nonexistent_key_xxx()")]])) + 'Vim(call):E5108: Lua: [string "luaeval()"]:0: attempt to call field \'xxx_nonexistent_key_xxx\' (a nil value)', + remove_trace(pcall_err(command, [[call luaeval("vim.xxx_nonexistent_key_xxx()")]])) + ) + eq( + 'Vim(call):E5108: Lua: [string "luaeval()"]:0: ERROR', + remove_trace(pcall_err(command, [[call luaeval("error('ERROR')")]])) ) eq( - 'Vim(call):E5108: Lua: [string "luaeval()"]:1: ERROR', - remove_trace(exc_exec([[call luaeval("error('ERROR')")]])) + 'Vim(call):E5108: Lua: [NULL]', + remove_trace(pcall_err(command, [[call luaeval("error(nil)")]])) ) - eq('Vim(call):E5108: Lua: [NULL]', remove_trace(exc_exec([[call luaeval("error(nil)")]]))) end) it('does not leak memory when called with too long line', function() local s = ('x'):rep(65536) eq( - 'Vim(call):E5107: Lua: [string "luaeval()"]:1: unexpected symbol near \')\'', - exc_exec([[call luaeval("(']] .. s .. [[' + )")]]) + 'Vim(call):E5107: Lua: [string "luaeval()"]:0: unexpected symbol near \')\'', + pcall_err(command, [[call luaeval("(']] .. s .. [[' + )")]]) ) eq(s, fn.luaeval('"' .. s .. '"')) end) |
