aboutsummaryrefslogtreecommitdiff
path: root/test/unit/helpers.lua
diff options
context:
space:
mode:
authorZyX <kp-pav@yandex.ru>2017-04-01 12:52:28 +0300
committerZyX <kp-pav@yandex.ru>2017-04-01 12:52:28 +0300
commit9dd0d4f8b9217f711fff32e9f47674e556a8fab0 (patch)
tree7a6fa451d674859d3c7aca308f443709446e56b3 /test/unit/helpers.lua
parent046d6a8dfe8ef5b319fdd7139303d46b56b5daa6 (diff)
downloadrneovim-9dd0d4f8b9217f711fff32e9f47674e556a8fab0.tar.gz
rneovim-9dd0d4f8b9217f711fff32e9f47674e556a8fab0.tar.bz2
rneovim-9dd0d4f8b9217f711fff32e9f47674e556a8fab0.zip
unittests: Add trace description right to the error message
Diffstat (limited to 'test/unit/helpers.lua')
-rw-r--r--test/unit/helpers.lua23
1 files changed, 14 insertions, 9 deletions
diff --git a/test/unit/helpers.lua b/test/unit/helpers.lua
index c8296abb2a..048027692a 100644
--- a/test/unit/helpers.lua
+++ b/test/unit/helpers.lua
@@ -11,6 +11,7 @@ local posix = nil
local syscall = nil
local check_cores = global_helpers.check_cores
+local dedent = global_helpers.dedent
local neq = global_helpers.neq
local map = global_helpers.map
local eq = global_helpers.eq
@@ -525,18 +526,22 @@ local hook_sfnamelen = 30
local hook_numlen = 5
local hook_msglen = 1 + 1 + 1 + (1 + hook_fnamelen) + (1 + hook_sfnamelen) + (1 + hook_numlen) + 1
+local tracehelp = dedent([[
+ ┌ Trace type: _r_eturn from function , function _c_all, _l_ine executed,
+ │ _t_ail return, _C_ount (should not actually appear).
+ │┏ Function type: _L_ua function, _C_ function, _m_ain part of chunk,
+ │┃ function that did _t_ail call.
+ │┃┌ Function name type: _g_lobal, _l_ocal, _m_ethod, _f_ield, _u_pvalue,
+ │┃│ space for unknown.
+ │┃│ ┏ Source file name ┌ Function name ┏ Line
+ │┃│ ┃ (trunc to 30 bytes, no .lua) │ (truncated to last 30 bytes) ┃ number
+ CWN SSSSSSSSSSSSSSSSSSSSSSSSSSSSSS:FFFFFFFFFFFFFFFFFFFFFFFFFFFFFF:LLLLL\n
+]])
+
local function child_sethook(wr)
if os.getenv('NVIM_TEST_NO_TRACE') == '1' then
return
end
- -- Message:
- -- |> msg char (1)
- -- ||> what char (1)
- -- |||> namewhat char (1)
- -- ||| |> source file name (30)
- -- ||| | |> function name (30)
- -- ||| | | |> line number (5)
- -- CWN SSSSSSSSSSSSSSSSSSSSSSSSSSSSSS:FFFFFFFFFFFFFFFFFFFFFFFFFFFFFF:LLLLL\n
local function hook(reason, lnum)
local msgchar = reason:sub(1, 1)
if reason == 'count' then
@@ -636,7 +641,7 @@ local function check_child_err(rd)
end
local res = sc.read(rd, 2)
if #res ~= 2 then
- local error = 'Test crashed, trace:\n'
+ local error = '\nTest crashed, trace:\n' .. tracehelp
for i = 1, #trace do
error = error .. trace[i]
end