From ddaa0cc9bebd8e094a7169f43947f298a3436ba9 Mon Sep 17 00:00:00 2001 From: Sean Dewar Date: Sat, 31 Jul 2021 00:47:24 +0100 Subject: [PATCH] fix(test/dumplog): tostring(rv) before formatting as string For example, implicitly converting a table to a string works in LuaJIT, but needs to be done explicitly with tostring() in Lua 5.1. This can cause issues when testing a non-JIT build if eq(), for example, fails with a table argument. E.g: eq({}, {1}) will not print the details of the assertion failure, but will instead print a less helpful "string expected, got table" error. --- test/helpers.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/helpers.lua b/test/helpers.lua index 469aee53f0..499d68b0d6 100644 --- a/test/helpers.lua +++ b/test/helpers.lua @@ -70,7 +70,7 @@ local function dumplog(logfile, 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', rv, logtail)) + error(string.format('%s\n%s', tostring(rv), logtail)) end end function module.eq(expected, actual, context, logfile)