aboutsummaryrefslogtreecommitdiff
path: root/test/functional/lua/vim_spec.lua
diff options
context:
space:
mode:
authorLewis Russell <lewis6991@gmail.com>2022-04-29 17:26:57 +0100
committerLewis Russell <lewis6991@gmail.com>2022-05-17 10:29:33 +0100
commit5c41165c8e89356bdb7d1b5835d1f79725b62d2c (patch)
tree1417c52d442a0091f3b29833d0d75210ad9e87ae /test/functional/lua/vim_spec.lua
parent6613f58cebde7db4e69709b84d511c32a7c4ce32 (diff)
downloadrneovim-5c41165c8e89356bdb7d1b5835d1f79725b62d2c.tar.gz
rneovim-5c41165c8e89356bdb7d1b5835d1f79725b62d2c.tar.bz2
rneovim-5c41165c8e89356bdb7d1b5835d1f79725b62d2c.zip
feat(lua): allow some viml functions to run in fast
This change adds the necessary plumbing to annotate functions in funcs.c as being allowed in run in luv fast events.
Diffstat (limited to 'test/functional/lua/vim_spec.lua')
-rw-r--r--test/functional/lua/vim_spec.lua14
1 files changed, 14 insertions, 0 deletions
diff --git a/test/functional/lua/vim_spec.lua b/test/functional/lua/vim_spec.lua
index 73e4d7ca79..1b9bdd147c 100644
--- a/test/functional/lua/vim_spec.lua
+++ b/test/functional/lua/vim_spec.lua
@@ -794,6 +794,20 @@ describe('lua stdlib', function()
pcall_err(exec_lua, "vim.fn.nvim_get_current_line()"))
end)
+ it('vim.fn can be called in fast events (if function is allowed)', function()
+ exec_lua([[
+ local timer = vim.loop.new_timer()
+ timer:start(0, 0, function()
+ timer:close()
+ assert(vim.in_fast_event())
+ vim.g.fnres = vim.fn.iconv('hello', 'utf-8', 'utf-8')
+ end)
+ ]])
+
+ helpers.poke_eventloop()
+ eq('hello', exec_lua[[return vim.g.fnres]])
+ end)
+
it('vim.rpcrequest and vim.rpcnotify', function()
exec_lua([[
chan = vim.fn.jobstart({'cat'}, {rpc=true})