mirror of
https://github.com/neovim/neovim.git
synced 2024-12-20 19:25:11 -07:00
052498ed42
Specifically, functions that are run in the context of the test runner are put in module `test/testutil.lua` while the functions that are run in the context of the test session are put in `test/functional/testnvim.lua`. Closes https://github.com/neovim/neovim/issues/27004.
31 lines
802 B
Lua
31 lines
802 B
Lua
-- Test suite for testing interactions with API bindings
|
|
local t = require('test.testutil')
|
|
local n = require('test.functional.testnvim')()
|
|
|
|
local clear = n.clear
|
|
local eq = t.eq
|
|
local exec_lua = n.exec_lua
|
|
|
|
describe('lua vim.mpack', function()
|
|
before_each(clear)
|
|
it('encodes vim.NIL', function()
|
|
eq(
|
|
{ true, true, true, true },
|
|
exec_lua [[
|
|
local var = vim.mpack.decode(vim.mpack.encode({33, vim.NIL, 77}))
|
|
return {var[1]==33, var[2]==vim.NIL, var[3]==77, var[4]==nil}
|
|
]]
|
|
)
|
|
end)
|
|
|
|
it('encodes vim.empty_dict()', function()
|
|
eq(
|
|
{ { {}, 'foo', {} }, true, false },
|
|
exec_lua [[
|
|
local var = vim.mpack.decode(vim.mpack.encode({{}, "foo", vim.empty_dict()}))
|
|
return {var, vim.islist(var[1]), vim.islist(var[3])}
|
|
]]
|
|
)
|
|
end)
|
|
end)
|