aboutsummaryrefslogtreecommitdiff
path: root/test/functional/lua/loop_spec.lua
diff options
context:
space:
mode:
authorBjörn Linse <bjorn.linse@gmail.com>2019-08-05 13:59:40 +0200
committerGitHub <noreply@github.com>2019-08-05 13:59:40 +0200
commitf5d1e0e7b1837e8b76f1561167543c90a9942a7a (patch)
treeae871874930fc44d4269c9c01eb7827da20998bc /test/functional/lua/loop_spec.lua
parent51440204e7973672f906db8e53035cfd228ce444 (diff)
parent88938634e7418ced4cfb074c48867523460dcc84 (diff)
downloadrneovim-f5d1e0e7b1837e8b76f1561167543c90a9942a7a.tar.gz
rneovim-f5d1e0e7b1837e8b76f1561167543c90a9942a7a.tar.bz2
rneovim-f5d1e0e7b1837e8b76f1561167543c90a9942a7a.zip
Merge pull request #10690 from bfredl/lua_print
lua: laundry list (crashes and additions)
Diffstat (limited to 'test/functional/lua/loop_spec.lua')
-rw-r--r--test/functional/lua/loop_spec.lua6
1 files changed, 5 insertions, 1 deletions
diff --git a/test/functional/lua/loop_spec.lua b/test/functional/lua/loop_spec.lua
index b96214738a..992d1666f6 100644
--- a/test/functional/lua/loop_spec.lua
+++ b/test/functional/lua/loop_spec.lua
@@ -75,6 +75,7 @@ describe('vim.loop', function()
exec_lua([[
local timer = vim.loop.new_timer()
timer:start(20, 0, function ()
+ _G.is_fast = vim.in_fast_event()
timer:close()
vim.api.nvim_set_var("valid", true)
vim.api.nvim_command("echomsg 'howdy'")
@@ -89,18 +90,20 @@ describe('vim.loop', function()
{1:~ }|
{2: }|
{3:Error executing luv callback:} |
- {3:[string "<nvim>"]:4: E5560: nvim_set_var must not }|
+ {3:[string "<nvim>"]:5: E5560: nvim_set_var must not }|
{3:be called in a lua loop callback} |
{4:Press ENTER or type command to continue}^ |
]])
feed('<cr>')
eq(false, eval("get(g:, 'valid', v:false)"))
+ eq(true, exec_lua("return _G.is_fast"))
-- callbacks can be scheduled to be executed in the main event loop
-- where the entire API is available
exec_lua([[
local timer = vim.loop.new_timer()
timer:start(20, 0, vim.schedule_wrap(function ()
+ _G.is_fast = vim.in_fast_event()
timer:close()
vim.api.nvim_set_var("valid", true)
vim.api.nvim_command("echomsg 'howdy'")
@@ -120,6 +123,7 @@ describe('vim.loop', function()
howdy |
]])
eq(true, eval("get(g:, 'valid', v:false)"))
+ eq(false, exec_lua("return _G.is_fast"))
-- fast (not deferred) API functions are allowed to be called directly
exec_lua([[