diff options
author | Björn Linse <bjorn.linse@gmail.com> | 2021-08-07 21:17:45 +0200 |
---|---|---|
committer | Björn Linse <bjorn.linse@gmail.com> | 2021-08-29 16:04:50 +0200 |
commit | 6896d22b63ad12de4c4990d0eece4a9b6f9cd88f (patch) | |
tree | 62b48d1cfefdc229c4dc8533a73454aeb0228823 /test/functional/lua/vim_spec.lua | |
parent | 636ecd0c3b8f8af70f536e17f11345f87e22b4d2 (diff) | |
download | rneovim-6896d22b63ad12de4c4990d0eece4a9b6f9cd88f.tar.gz rneovim-6896d22b63ad12de4c4990d0eece4a9b6f9cd88f.tar.bz2 rneovim-6896d22b63ad12de4c4990d0eece4a9b6f9cd88f.zip |
fix(lua): preserve argument lists which are not lists
Diffstat (limited to 'test/functional/lua/vim_spec.lua')
-rw-r--r-- | test/functional/lua/vim_spec.lua | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/test/functional/lua/vim_spec.lua b/test/functional/lua/vim_spec.lua index 4e2bed4deb..0ea914880f 100644 --- a/test/functional/lua/vim_spec.lua +++ b/test/functional/lua/vim_spec.lua @@ -17,6 +17,7 @@ local matches = helpers.matches local source = helpers.source local NIL = helpers.NIL local retry = helpers.retry +local next_msg = helpers.next_msg before_each(clear) @@ -2178,6 +2179,24 @@ describe('lua stdlib', function() end) end) + describe('vim.schedule_wrap', function() + it('preserves argument lists', function() + exec_lua [[ + local fun = vim.schedule_wrap(function(kling, klang, klonk) + vim.rpcnotify(1, 'mayday_mayday', {a=kling, b=klang, c=klonk}) + end) + fun("BOB", nil, "MIKE") + ]] + eq({'notification', 'mayday_mayday', {{a='BOB', c='MIKE'}}}, next_msg()) + + -- let's gooooo + exec_lua [[ + vim.schedule_wrap(function(...) vim.rpcnotify(1, 'boogalo', select('#', ...)) end)(nil,nil,nil,nil) + ]] + eq({'notification', 'boogalo', {4}}, next_msg()) + end) + end) + describe('vim.api.nvim_buf_call', function() it('can access buf options', function() local buf1 = meths.get_current_buf() |