diff options
author | Gregory Anders <8965202+gpanders@users.noreply.github.com> | 2021-11-06 08:26:10 -0600 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-11-06 08:26:10 -0600 |
commit | 03b805aee617f67eb7f33a54822bc76c23a2c5f5 (patch) | |
tree | fc27127d462fe91159eb99c5a724c7b10e459f1b /test/helpers.lua | |
parent | 1fdbd29dfa6366f8346693d0bf67f4f782ab0f32 (diff) | |
download | rneovim-03b805aee617f67eb7f33a54822bc76c23a2c5f5.tar.gz rneovim-03b805aee617f67eb7f33a54822bc76c23a2c5f5.tar.bz2 rneovim-03b805aee617f67eb7f33a54822bc76c23a2c5f5.zip |
feat(lua): enable stack traces in error output (#16228)
Diffstat (limited to 'test/helpers.lua')
-rw-r--r-- | test/helpers.lua | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/test/helpers.lua b/test/helpers.lua index 9ac3904776..09b113c01d 100644 --- a/test/helpers.lua +++ b/test/helpers.lua @@ -155,12 +155,20 @@ function module.pcall_err_withfile(fn, ...) return errmsg end -function module.pcall_err(fn, ...) +function module.pcall_err_withtrace(fn, ...) local errmsg = module.pcall_err_withfile(fn, ...) return errmsg:gsub('.../helpers.lua:0: ', '') end +function module.pcall_err(...) + return module.remove_trace(module.pcall_err_withtrace(...)) +end + +function module.remove_trace(s) + return (s:gsub("\n%s*stack traceback:.*", "")) +end + -- initial_path: directory to recurse into -- re: include pattern (string) -- exc_re: exclude pattern(s) (string or table) |