diff options
author | Gregory Anders <greg@gpanders.com> | 2021-12-22 11:40:21 -0700 |
---|---|---|
committer | Gregory Anders <greg@gpanders.com> | 2021-12-28 14:08:44 -0700 |
commit | eff11b3c3fcb9aa777deafb0a33b1523aa05b603 (patch) | |
tree | ff517e6b769f8604a1a6f24826405594859ec95b /test/functional/lua/api_spec.lua | |
parent | 9804a2870f6f308f788f939f52958e3fbd2adaac (diff) | |
download | rneovim-eff11b3c3fcb9aa777deafb0a33b1523aa05b603.tar.gz rneovim-eff11b3c3fcb9aa777deafb0a33b1523aa05b603.tar.bz2 rneovim-eff11b3c3fcb9aa777deafb0a33b1523aa05b603.zip |
feat(api): implement nvim_{add,del}_user_command
Add support for adding and removing custom user commands with the Nvim
API.
Diffstat (limited to 'test/functional/lua/api_spec.lua')
-rw-r--r-- | test/functional/lua/api_spec.lua | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/test/functional/lua/api_spec.lua b/test/functional/lua/api_spec.lua index 81e00bba6d..f6038e23fe 100644 --- a/test/functional/lua/api_spec.lua +++ b/test/functional/lua/api_spec.lua @@ -8,6 +8,7 @@ local clear = helpers.clear local eval = helpers.eval local NIL = helpers.NIL local eq = helpers.eq +local exec_lua = helpers.exec_lua before_each(clear) @@ -111,6 +112,12 @@ describe('luaeval(vim.api.…)', function() eq(7, eval([[type(luaeval('vim.api.nvim__id(nil)'))]])) eq({foo=1, bar={42, {{baz=true}, 5}}}, funcs.luaeval('vim.api.nvim__id({foo=1, bar={42, {{baz=true}, 5}}})')) + + eq(true, funcs.luaeval('vim.api.nvim__id(vim.api.nvim__id)(true)')) + eq(42, exec_lua [[ + local f = vim.api.nvim__id({42, vim.api.nvim__id}) + return f[2](f[1]) + ]]) end) it('correctly converts container objects with type_idx to API objects', function() @@ -159,12 +166,8 @@ describe('luaeval(vim.api.…)', function() it('errors out correctly when working with API', function() -- Conversion errors - eq('Vim(call):E5108: Error executing lua [string "luaeval()"]:1: Cannot convert given lua type', - remove_trace(exc_exec([[call luaeval("vim.api.nvim__id(vim.api.nvim__id)")]]))) eq('Vim(call):E5108: Error executing lua [string "luaeval()"]:1: Cannot convert given lua table', remove_trace(exc_exec([[call luaeval("vim.api.nvim__id({1, foo=42})")]]))) - eq('Vim(call):E5108: Error executing lua [string "luaeval()"]:1: Cannot convert given lua type', - remove_trace(exc_exec([[call luaeval("vim.api.nvim__id({42, vim.api.nvim__id})")]]))) -- Errors in number of arguments eq('Vim(call):E5108: Error executing lua [string "luaeval()"]:1: Expected 1 argument', remove_trace(exc_exec([[call luaeval("vim.api.nvim__id()")]]))) |