aboutsummaryrefslogtreecommitdiff
path: root/test/functional/lua/mpack_spec.lua
diff options
context:
space:
mode:
authorBjörn Linse <bjorn.linse@gmail.com>2021-09-09 18:47:03 +0200
committerGitHub <noreply@github.com>2021-09-09 18:47:03 +0200
commitd80aac3b2a3ce4b25d4f12ff64b8c947eaf75826 (patch)
treeb10dcaea8ee55a9f27b528360eb0dab50e165121 /test/functional/lua/mpack_spec.lua
parent13748512f6d6dfb5895c2233d2e07480e00eb753 (diff)
parentad8eda3f5b7db424de912ac748bce6b02e43f64f (diff)
downloadrneovim-d80aac3b2a3ce4b25d4f12ff64b8c947eaf75826.tar.gz
rneovim-d80aac3b2a3ce4b25d4f12ff64b8c947eaf75826.tar.bz2
rneovim-d80aac3b2a3ce4b25d4f12ff64b8c947eaf75826.zip
Merge pull request #15566 from bfredl/mpack
libs: vendor libmpack and libmpack-lua
Diffstat (limited to 'test/functional/lua/mpack_spec.lua')
-rw-r--r--test/functional/lua/mpack_spec.lua23
1 files changed, 23 insertions, 0 deletions
diff --git a/test/functional/lua/mpack_spec.lua b/test/functional/lua/mpack_spec.lua
new file mode 100644
index 0000000000..ef693f01f3
--- /dev/null
+++ b/test/functional/lua/mpack_spec.lua
@@ -0,0 +1,23 @@
+-- Test suite for testing interactions with API bindings
+local helpers = require('test.functional.helpers')(after_each)
+
+local clear = helpers.clear
+local eq = helpers.eq
+local exec_lua = helpers.exec_lua
+
+describe('lua vim.mpack', function()
+ before_each(clear)
+ it('can pack vim.NIL', function()
+ eq({true, true, true, true}, exec_lua [[
+ local var = vim.mpack.unpack(vim.mpack.pack({33, vim.NIL, 77}))
+ return {var[1]==33, var[2]==vim.NIL, var[3]==77, var[4]==nil}
+ ]])
+ end)
+
+ it('can pack vim.empty_dict()', function()
+ eq({{{}, "foo", {}}, true, false}, exec_lua [[
+ local var = vim.mpack.unpack(vim.mpack.pack({{}, "foo", vim.empty_dict()}))
+ return {var, vim.tbl_islist(var[1]), vim.tbl_islist(var[3])}
+ ]])
+ end)
+end)