mirror of
https://github.com/neovim/neovim.git
synced 2025-12-08 15:42:52 +00:00
test: check vim.wait() error message in fast context (#26242)
This commit is contained in:
@@ -11,6 +11,7 @@ local insert = helpers.insert
|
|||||||
local clear = helpers.clear
|
local clear = helpers.clear
|
||||||
local eq = helpers.eq
|
local eq = helpers.eq
|
||||||
local ok = helpers.ok
|
local ok = helpers.ok
|
||||||
|
local pesc = helpers.pesc
|
||||||
local eval = helpers.eval
|
local eval = helpers.eval
|
||||||
local feed = helpers.feed
|
local feed = helpers.feed
|
||||||
local pcall_err = helpers.pcall_err
|
local pcall_err = helpers.pcall_err
|
||||||
@@ -2771,15 +2772,19 @@ describe('lua stdlib', function()
|
|||||||
end)
|
end)
|
||||||
|
|
||||||
it('should not run in fast callbacks #26122', function()
|
it('should not run in fast callbacks #26122', function()
|
||||||
|
local screen = Screen.new(80, 10)
|
||||||
|
screen:attach()
|
||||||
exec_lua([[
|
exec_lua([[
|
||||||
vim.uv.new_timer():start(0, 100, function()
|
local timer = vim.uv.new_timer()
|
||||||
local count = 0
|
timer:start(0, 0, function()
|
||||||
vim.wait(100, function()
|
timer:close()
|
||||||
count = count + 1
|
vim.wait(100, function() end)
|
||||||
return count == 10
|
|
||||||
end, 100)
|
|
||||||
end)
|
end)
|
||||||
]])
|
]])
|
||||||
|
screen:expect({
|
||||||
|
any = pesc('E5560: vim.wait must not be called in a lua loop callback'),
|
||||||
|
})
|
||||||
|
feed('<CR>')
|
||||||
assert_alive()
|
assert_alive()
|
||||||
end)
|
end)
|
||||||
end)
|
end)
|
||||||
|
|||||||
Reference in New Issue
Block a user