aboutsummaryrefslogtreecommitdiff
path: root/test/functional/lua/luaeval_spec.lua
diff options
context:
space:
mode:
authorJustin M. Keyes <justinkz@gmail.com>2021-08-23 02:37:07 -0700
committerJustin M. Keyes <justinkz@gmail.com>2025-05-04 11:22:57 -0400
commitfc2dee17368d76e7e845872990bb6fdef1c6bf54 (patch)
tree6c8862b5b1d17c86bf3bc61065e1c9a8456cb415 /test/functional/lua/luaeval_spec.lua
parentaf4f7f1618ad6e11d616b2c69af8945f46d0e199 (diff)
downloadrneovim-fc2dee17368d76e7e845872990bb6fdef1c6bf54.tar.gz
rneovim-fc2dee17368d76e7e845872990bb6fdef1c6bf54.tar.bz2
rneovim-fc2dee17368d76e7e845872990bb6fdef1c6bf54.zip
feat(messages): cleanup Lua error messages
"Error" in error messages is redundant. Just provide the context, don't say "Error ...".
Diffstat (limited to 'test/functional/lua/luaeval_spec.lua')
-rw-r--r--test/functional/lua/luaeval_spec.lua18
1 files changed, 9 insertions, 9 deletions
diff --git a/test/functional/lua/luaeval_spec.lua b/test/functional/lua/luaeval_spec.lua
index 5fea79141c..495525b1e9 100644
--- a/test/functional/lua/luaeval_spec.lua
+++ b/test/functional/lua/luaeval_spec.lua
@@ -189,9 +189,9 @@ describe('luaeval()', 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}")'))
- startswith("Vim(call):E5107: Error loading lua [string \"luaeval()\"]:",
+ startswith("Vim(call):E5107: Lua: [string \"luaeval()\"]:",
exc_exec('call luaeval("1, 2, 3")'))
- startswith("Vim(call):E5108: Error executing lua [string \"luaeval()\"]:",
+ startswith("Vim(call):E5108: Lua: [string \"luaeval()\"]:",
exc_exec('call luaeval("(nil)()")'))
end)
@@ -428,18 +428,18 @@ describe('luaeval()', function()
it('errors out correctly when doing incorrect things in lua', function()
-- Conversion errors
- eq('Vim(call):E5108: Error executing lua [string "luaeval()"]:1: attempt to call field \'xxx_nonexistent_key_xxx\' (a nil value)',
+ 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()")]])))
- eq('Vim(call):E5108: Error executing lua [string "luaeval()"]:1: ERROR',
+ eq('Vim(call):E5108: Lua: [string "luaeval()"]:1: ERROR',
remove_trace(exc_exec([[call luaeval("error('ERROR')")]])))
- eq('Vim(call):E5108: Error executing lua [NULL]',
+ 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: Error loading lua [string "luaeval()"]:1: unexpected symbol near \')\'',
+ eq('Vim(call):E5107: Lua: [string "luaeval()"]:1: unexpected symbol near \')\'',
exc_exec([[call luaeval("(']] .. s ..[[' + )")]]))
eq(s, fn.luaeval('"' .. s .. '"'))
end)
@@ -482,7 +482,7 @@ describe('v:lua', function()
eq("string: abc", eval('v:lua.mymod.whatis(0z616263)'))
eq("string: ", eval('v:lua.mymod.whatis(v:_null_blob)'))
- eq("Vim:E5108: Error executing lua [string \"<nvim>\"]:0: attempt to call global 'nonexistent' (a nil value)",
+ eq("Vim:E5108: Lua: [string \"<nvim>\"]:0: attempt to call global 'nonexistent' (a nil value)",
pcall_err(eval, 'v:lua.mymod.crashy()'))
end)
@@ -497,14 +497,14 @@ describe('v:lua', function()
eq("hey there", api.nvim_get_current_line())
eq({5, 10, 15, 20}, eval('[[1], [2, 3], [4]]->v:lua.vim.tbl_flatten()->map({_, v -> v * 5})'))
- eq("Vim:E5108: Error executing lua [string \"<nvim>\"]:0: attempt to call global 'nonexistent' (a nil value)",
+ eq("Vim:E5108: Lua: [string \"<nvim>\"]:0: attempt to call global 'nonexistent' (a nil value)",
pcall_err(eval, '"huh?"->v:lua.mymod.crashy()'))
end)
it('works in :call', function()
command(":call v:lua.mymod.noisy('command')")
eq("hey command", api.nvim_get_current_line())
- eq("Vim(call):E5108: Error executing lua [string \"<nvim>\"]:0: attempt to call global 'nonexistent' (a nil value)",
+ eq("Vim(call):E5108: Lua: [string \"<nvim>\"]:0: attempt to call global 'nonexistent' (a nil value)",
pcall_err(command, 'call v:lua.mymod.crashy()'))
end)