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.
This commit is contained in:
Sean Dewar 2021-07-31 00:47:24 +01:00
parent 5fdf741f77
commit ddaa0cc9be
No known key found for this signature in database
GPG Key ID: 08CC2C83AD41B581

View File

@ -70,7 +70,7 @@ local function dumplog(logfile, fn, ...)
if status == false then if status == false then
logfile = logfile or os.getenv('NVIM_LOG_FILE') or '.nvimlog' logfile = logfile or os.getenv('NVIM_LOG_FILE') or '.nvimlog'
local logtail = module.read_nvim_log(logfile) 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
end end
function module.eq(expected, actual, context, logfile) function module.eq(expected, actual, context, logfile)