aboutsummaryrefslogtreecommitdiff
path: root/test/helpers.lua
diff options
context:
space:
mode:
authorJustin M. Keyes <justinkz@gmail.com>2022-05-30 02:40:17 -0700
committerJustin M. Keyes <justinkz@gmail.com>2022-06-15 19:23:10 -0700
commitb6467dfc23dab476e256490b8014bbb488684e6b (patch)
tree9cc3e081012172c1c57d70312eae7a43c600b8ee /test/helpers.lua
parent8f065205946844d87f00d6c55517521e3809f821 (diff)
downloadrneovim-b6467dfc23dab476e256490b8014bbb488684e6b.tar.gz
rneovim-b6467dfc23dab476e256490b8014bbb488684e6b.tar.bz2
rneovim-b6467dfc23dab476e256490b8014bbb488684e6b.zip
test(report): formatting, drop dumplog()
Don't need to dumplog() on each failed test because we now have test-ids that associate log messages with tests.
Diffstat (limited to 'test/helpers.lua')
-rw-r--r--test/helpers.lua35
1 files changed, 8 insertions, 27 deletions
diff --git a/test/helpers.lua b/test/helpers.lua
index f37af9d08d..a3482d1b46 100644
--- a/test/helpers.lua
+++ b/test/helpers.lua
@@ -51,42 +51,23 @@ local check_logs_useless_lines = {
['See README_MISSING_SYSCALL_OR_IOCTL for guidance']=3,
}
---- Invokes `fn` and includes the tail of `logfile` in the error message if it
---- fails.
----
----@param logfile string Log file, defaults to $NVIM_LOG_FILE or '.nvimlog'
----@param fn string Function to invoke
----@param ... string Function arguments
-local function dumplog(logfile, fn, ...)
- -- module.validate({
- -- logfile={logfile,'s',true},
- -- fn={fn,'f',false},
- -- })
- local status, rv = pcall(fn, ...)
- if status == false then
- logfile = logfile or os.getenv('NVIM_LOG_FILE') or '.nvimlog'
- local logtail = module.read_nvim_log(logfile)
- error(string.format('%s\n%s', tostring(rv), logtail))
- end
-end
-function module.eq(expected, actual, context, logfile)
- return dumplog(logfile, assert.are.same, expected, actual, context)
+function module.eq(expected, actual, context)
+ return assert.are.same(expected, actual, context)
end
-function module.neq(expected, actual, context, logfile)
- return dumplog(logfile, assert.are_not.same, expected, actual, context)
+function module.neq(expected, actual, context)
+ return assert.are_not.same(expected, actual, context)
end
-function module.ok(res, msg, logfile)
- return dumplog(logfile, assert.is_true, res, msg)
+function module.ok(res, msg)
+ return assert.is_true(res, msg)
end
--- TODO(bfredl): this should "failure" not "error" (issue with dumplog() )
local function epicfail(state, arguments, _)
state.failure_message = arguments[1]
return false
end
assert:register("assertion", "epicfail", epicfail)
-function module.fail(msg, logfile)
- return dumplog(logfile, assert.epicfail, msg)
+function module.fail(msg)
+ return assert.epicfail(msg)
end
function module.matches(pat, actual)