aboutsummaryrefslogtreecommitdiff
path: root/test/helpers.lua
diff options
context:
space:
mode:
Diffstat (limited to 'test/helpers.lua')
-rw-r--r--test/helpers.lua10
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)