forked from neovim/neovim
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(lua): make vim.mpack support vim.NIL and vim.empty_dict()
- Loading branch information
Showing
4 changed files
with
87 additions
and
16 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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) |