aboutsummaryrefslogtreecommitdiff
path: root/test/helpers.lua
diff options
context:
space:
mode:
authorSean Dewar <seandewar@users.noreply.github.com>2021-07-31 00:47:24 +0100
committerSean Dewar <seandewar@users.noreply.github.com>2021-09-16 00:14:47 +0100
commitddaa0cc9bebd8e094a7169f43947f298a3436ba9 (patch)
treee26566fe190550a8d69305a3d0817b20dfea756c /test/helpers.lua
parent5fdf741f77c3b6ebed9b5cdc0e9d1043080beb3c (diff)
downloadrneovim-ddaa0cc9bebd8e094a7169f43947f298a3436ba9.tar.gz
rneovim-ddaa0cc9bebd8e094a7169f43947f298a3436ba9.tar.bz2
rneovim-ddaa0cc9bebd8e094a7169f43947f298a3436ba9.zip
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.
Diffstat (limited to 'test/helpers.lua')
-rw-r--r--test/helpers.lua2
1 files changed, 1 insertions, 1 deletions
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)