aboutsummaryrefslogtreecommitdiff
path: root/test/functional/helpers.lua
diff options
context:
space:
mode:
Diffstat (limited to 'test/functional/helpers.lua')
-rw-r--r--test/functional/helpers.lua26
1 files changed, 25 insertions, 1 deletions
diff --git a/test/functional/helpers.lua b/test/functional/helpers.lua
index 4db658d98c..65d1ad76ef 100644
--- a/test/functional/helpers.lua
+++ b/test/functional/helpers.lua
@@ -9,6 +9,7 @@ local TcpStream = require('nvim.tcp_stream')
local SocketStream = require('nvim.socket_stream')
local ChildProcessStream = require('nvim.child_process_stream')
+local check_cores = global_helpers.check_cores
local check_logs = global_helpers.check_logs
local neq = global_helpers.neq
local eq = global_helpers.eq
@@ -343,6 +344,16 @@ local function write_file(name, text, dont_dedent)
file:close()
end
+local function read_file(name)
+ local file = io.open(name, 'r')
+ if not file then
+ return nil
+ end
+ local ret = file:read('*a')
+ file:close()
+ return ret
+end
+
local function source(code)
local fname = tmpname()
write_file(fname, code)
@@ -533,6 +544,14 @@ local function skip_fragile(pending_fn, cond)
return false
end
+local function meth_pcall(...)
+ local ret = {pcall(...)}
+ if type(ret[2]) == 'string' then
+ ret[2] = ret[2]:gsub('^[^:]+:%d+: ', '')
+ end
+ return ret
+end
+
local funcs = create_callindex(nvim_call)
local meths = create_callindex(nvim)
local uimeths = create_callindex(ui)
@@ -584,6 +603,7 @@ local M = {
sleep = sleep,
set_session = set_session,
write_file = write_file,
+ read_file = read_file,
os_name = os_name,
rmdir = rmdir,
mkdir = lfs.mkdir,
@@ -603,12 +623,16 @@ local M = {
skip_fragile = skip_fragile,
set_shell_powershell = set_shell_powershell,
tmpname = tmpname,
+ meth_pcall = meth_pcall,
NIL = mpack.NIL,
}
return function(after_each)
if after_each then
- after_each(check_logs)
+ after_each(function()
+ check_logs()
+ check_cores('build/bin/nvim')
+ end)
end
return M
end