feat(lua): enable stack traces in error output (#16228)

This commit is contained in:
Gregory Anders
2021-11-06 08:26:10 -06:00
committed by GitHub
parent 1fdbd29dfa
commit 03b805aee6
13 changed files with 174 additions and 195 deletions

View File

@ -4,6 +4,7 @@ local Screen = require('test.functional.ui.screen')
local pcall_err = helpers.pcall_err
local exc_exec = helpers.exc_exec
local remove_trace = helpers.remove_trace
local exec_lua = helpers.exec_lua
local command = helpers.command
local meths = helpers.meths
@ -424,11 +425,11 @@ 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)',
exc_exec([[call luaeval("vim.xxx_nonexistent_key_xxx()")]]))
remove_trace(exc_exec([[call luaeval("vim.xxx_nonexistent_key_xxx()")]])))
eq('Vim(call):E5108: Error executing lua [string "luaeval()"]:1: ERROR',
exc_exec([[call luaeval("error('ERROR')")]]))
remove_trace(exc_exec([[call luaeval("error('ERROR')")]])))
eq('Vim(call):E5108: Error executing lua [NULL]',
exc_exec([[call luaeval("error(nil)")]]))
remove_trace(exc_exec([[call luaeval("error(nil)")]])))
end)
it('does not leak memory when called with too long line',