aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--test/unit/helpers.lua17
-rw-r--r--test/unit/viml/expressions/parser_spec.lua2
2 files changed, 18 insertions, 1 deletions
diff --git a/test/unit/helpers.lua b/test/unit/helpers.lua
index 96aa505739..2c148630dd 100644
--- a/test/unit/helpers.lua
+++ b/test/unit/helpers.lua
@@ -529,9 +529,13 @@ local hook_numlen = 5
local hook_msglen = 1 + 1 + 1 + (1 + hook_fnamelen) + (1 + hook_sfnamelen) + (1 + hook_numlen) + 1
local tracehelp = dedent([[
+ Trace: either in the format described below or custom debug output starting
+ with `>`. Latter lines still have the same width in byte.
+
┌ Trace type: _r_eturn from function , function _c_all, _l_ine executed,
│ _t_ail return, _C_ount (should not actually appear),
- │ _s_aved from previous run for reference.
+ │ _s_aved from previous run for reference, _>_ for custom debug
+ │ output.
│┏ 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,
@@ -629,7 +633,17 @@ end
local trace_end_msg = ('E%s\n'):format((' '):rep(hook_msglen - 2))
+local _debug_log
+
+local debug_log = only_separate(function(...)
+ return _debug_log(...)
+end)
+
local function itp_child(wr, func)
+ _debug_log = function(s)
+ s = s:sub(1, hook_msglen - 2)
+ sc.write(wr, '>' .. s .. (' '):rep(hook_msglen - 2 - #s) .. '\n')
+ end
init()
collectgarbage('stop')
child_sethook(wr)
@@ -845,6 +859,7 @@ local module = {
make_enum_conv_tab = make_enum_conv_tab,
ptr2addr = ptr2addr,
ptr2key = ptr2key,
+ debug_log = debug_log,
}
return function()
return module
diff --git a/test/unit/viml/expressions/parser_spec.lua b/test/unit/viml/expressions/parser_spec.lua
index e5d0f2b84c..cfc9fe95ac 100644
--- a/test/unit/viml/expressions/parser_spec.lua
+++ b/test/unit/viml/expressions/parser_spec.lua
@@ -8,6 +8,7 @@ local child_call_once = helpers.child_call_once
local alloc_log_new = helpers.alloc_log_new
local kvi_destroy = helpers.kvi_destroy
local conv_enum = helpers.conv_enum
+local debug_log = helpers.debug_log
local ptr2key = helpers.ptr2key
local cimport = helpers.cimport
local ffi = helpers.ffi
@@ -233,6 +234,7 @@ describe('Expressions parser', function()
local function check_parsing(str, exp_ast, exp_highlighting_fs, nz_flags_exps)
nz_flags_exps = nz_flags_exps or {}
for _, flags in ipairs({0, 1, 2, 3}) do
+ debug_log(('Running test case (%s, %u)'):format(str, flags))
local err, msg = pcall(function()
if os.getenv('NVIM_TEST_PARSER_SPEC_PRINT_TEST_CASE') == '1' then
print(str, flags)