diff options
author | zeertzjq <zeertzjq@outlook.com> | 2023-11-27 18:24:32 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-11-27 18:24:32 +0800 |
commit | a03bd2b87882c2a7e0c9e63dadcb2e5fabda1670 (patch) | |
tree | df16796ddf62d87f55702c113752684333568eed | |
parent | 2c16c6a6c42f46e290df5441c37572f296aeb09f (diff) | |
download | rneovim-a03bd2b87882c2a7e0c9e63dadcb2e5fabda1670.tar.gz rneovim-a03bd2b87882c2a7e0c9e63dadcb2e5fabda1670.tar.bz2 rneovim-a03bd2b87882c2a7e0c9e63dadcb2e5fabda1670.zip |
test: check vim.wait() error message in fast context (#26242)
-rw-r--r-- | test/functional/lua/vim_spec.lua | 17 |
1 files changed, 11 insertions, 6 deletions
diff --git a/test/functional/lua/vim_spec.lua b/test/functional/lua/vim_spec.lua index 61fa16f59d..ebe5fc254e 100644 --- a/test/functional/lua/vim_spec.lua +++ b/test/functional/lua/vim_spec.lua @@ -11,6 +11,7 @@ local insert = helpers.insert local clear = helpers.clear local eq = helpers.eq local ok = helpers.ok +local pesc = helpers.pesc local eval = helpers.eval local feed = helpers.feed local pcall_err = helpers.pcall_err @@ -2771,15 +2772,19 @@ describe('lua stdlib', function() end) it('should not run in fast callbacks #26122', function() + local screen = Screen.new(80, 10) + screen:attach() exec_lua([[ - vim.uv.new_timer():start(0, 100, function() - local count = 0 - vim.wait(100, function() - count = count + 1 - return count == 10 - end, 100) + local timer = vim.uv.new_timer() + timer:start(0, 0, function() + timer:close() + vim.wait(100, function() end) end) ]]) + screen:expect({ + any = pesc('E5560: vim.wait must not be called in a lua loop callback'), + }) + feed('<CR>') assert_alive() end) end) |