aboutsummaryrefslogtreecommitdiff
path: root/test/functional/lua/api_spec.lua
diff options
context:
space:
mode:
authorSean Dewar <seandewar@users.noreply.github.com>2022-02-26 13:27:43 +0000
committerSean Dewar <seandewar@users.noreply.github.com>2022-02-26 14:18:34 +0000
commitf6cc604af2a4d95ec9bcaa5bee705cec2e06d541 (patch)
treeaaddcdda79c238dd2c799ba27ba936670873b566 /test/functional/lua/api_spec.lua
parentd0f8f76224f501d919ba6c8a5cd717de76903b34 (diff)
downloadrneovim-f6cc604af2a4d95ec9bcaa5bee705cec2e06d541.tar.gz
rneovim-f6cc604af2a4d95ec9bcaa5bee705cec2e06d541.tar.bz2
rneovim-f6cc604af2a4d95ec9bcaa5bee705cec2e06d541.zip
fix(api): convert blob to NUL-terminated API string
Looks like I did an oopsie; although API strings carry a size field, they should still be usable as C-strings! (even though they may contain embedded NULs)
Diffstat (limited to 'test/functional/lua/api_spec.lua')
-rw-r--r--test/functional/lua/api_spec.lua7
1 files changed, 7 insertions, 0 deletions
diff --git a/test/functional/lua/api_spec.lua b/test/functional/lua/api_spec.lua
index cb37fb9a1c..f173a15d32 100644
--- a/test/functional/lua/api_spec.lua
+++ b/test/functional/lua/api_spec.lua
@@ -102,6 +102,13 @@ describe('luaeval(vim.api.…)', function()
eq(false, funcs.luaeval('vim.api.nvim__id(false)'))
eq(NIL, funcs.luaeval('vim.api.nvim__id(nil)'))
+ -- API strings from Blobs can work as NUL-terminated C strings
+ eq('Vim(call):E5555: API call: Vim:E15: Invalid expression: ',
+ exc_exec('call nvim_eval(v:_null_blob)'))
+ eq('Vim(call):E5555: API call: Vim:E15: Invalid expression: ',
+ exc_exec('call nvim_eval(0z)'))
+ eq(1, eval('nvim_eval(0z31)'))
+
eq(0, eval([[type(luaeval('vim.api.nvim__id(1)'))]]))
eq(1, eval([[type(luaeval('vim.api.nvim__id("1")'))]]))
eq(3, eval([[type(luaeval('vim.api.nvim__id({1})'))]]))