2021-09-04 08:39:22 -07:00
|
|
|
-- 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)
|
2021-10-30 06:59:59 -07:00
|
|
|
it('encodes vim.NIL', function()
|
2021-09-04 08:39:22 -07:00
|
|
|
eq({true, true, true, true}, exec_lua [[
|
2021-10-30 06:59:59 -07:00
|
|
|
local var = vim.mpack.decode(vim.mpack.encode({33, vim.NIL, 77}))
|
2021-09-04 08:39:22 -07:00
|
|
|
return {var[1]==33, var[2]==vim.NIL, var[3]==77, var[4]==nil}
|
|
|
|
]])
|
|
|
|
end)
|
|
|
|
|
2021-10-30 06:59:59 -07:00
|
|
|
it('encodes vim.empty_dict()', function()
|
2021-09-04 08:39:22 -07:00
|
|
|
eq({{{}, "foo", {}}, true, false}, exec_lua [[
|
2021-10-30 06:59:59 -07:00
|
|
|
local var = vim.mpack.decode(vim.mpack.encode({{}, "foo", vim.empty_dict()}))
|
2021-09-04 08:39:22 -07:00
|
|
|
return {var, vim.tbl_islist(var[1]), vim.tbl_islist(var[3])}
|
|
|
|
]])
|
|
|
|
end)
|
|
|
|
end)
|