aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--test/unit/strings_spec.lua8
1 files changed, 7 insertions, 1 deletions
diff --git a/test/unit/strings_spec.lua b/test/unit/strings_spec.lua
index 25cdc27b28..86d528f0e8 100644
--- a/test/unit/strings_spec.lua
+++ b/test/unit/strings_spec.lua
@@ -140,7 +140,13 @@ end)
describe('vim_snprintf()', function()
local function a(expected, buf, bsize, fmt, ...)
- eq(#expected, strings.vim_snprintf(buf, bsize, fmt, ...))
+ local args = { ... }
+ local ctx = string.format('snprintf(buf, %d, "%s"', bsize, fmt)
+ for _, x in ipairs(args) do
+ ctx = ctx .. ', ' .. tostring(x)
+ end
+ ctx = ctx .. string.format(') = %s', expected)
+ eq(#expected, strings.vim_snprintf(buf, bsize, fmt, ...), ctx)
if bsize > 0 then
local actual = ffi.string(buf, math.min(#expected + 1, bsize))
eq(expected:sub(1, bsize - 1) .. '\0', actual)