mirror of
https://github.com/neovim/neovim.git
synced 2025-02-25 18:55:25 -06:00
unittests: Add a way to print trace on regular error
This commit is contained in:
parent
520c0b91a5
commit
190c8516f5
@ -110,3 +110,6 @@ disables tracing (the fastest, but you get no data if tests crash and there was
|
||||
no core dump generated), `1` or empty/undefined leaves only C function cals and
|
||||
returns in the trace (faster then recording everything), `2` records all
|
||||
function calls, returns and lua source lines exuecuted.
|
||||
|
||||
`NVIM_TEST_TRACE_ON_ERROR` (U) (1): makes unit tests yield trace on error in
|
||||
addition to regular error message.
|
||||
|
@ -698,7 +698,14 @@ local function check_child_err(rd)
|
||||
local len_s = sc.read(rd, 5)
|
||||
local len = tonumber(len_s)
|
||||
neq(0, len)
|
||||
local err = sc.read(rd, len + 1)
|
||||
local err = ''
|
||||
if os.getenv('NVIM_TEST_TRACE_ON_ERROR') == '1' and #trace ~= 0 then
|
||||
err = '\nTest failed, trace:\n' .. tracehelp
|
||||
for _, traceline in ipairs(trace) do
|
||||
err = err .. traceline
|
||||
end
|
||||
end
|
||||
err = err .. sc.read(rd, len + 1)
|
||||
assert.just_fail(err)
|
||||
end
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user