aboutsummaryrefslogtreecommitdiff
path: root/test/functional/lua/overrides_spec.lua
diff options
context:
space:
mode:
authorLewis Russell <lewis6991@gmail.com>2024-08-11 09:27:48 +0100
committerLewis Russell <me@lewisr.dev>2024-09-21 16:04:09 +0100
commite5c174421df3872df0dd3a676609d1e74dfef6a9 (patch)
tree39354b9db7b9f3ccb9145f52d11574baa4508951 /test/functional/lua/overrides_spec.lua
parenta19e89022d8b72ee92bb974100b497f1c79b7765 (diff)
downloadrneovim-e5c174421df3872df0dd3a676609d1e74dfef6a9.tar.gz
rneovim-e5c174421df3872df0dd3a676609d1e74dfef6a9.tar.bz2
rneovim-e5c174421df3872df0dd3a676609d1e74dfef6a9.zip
test: support upvalues in exec_lua
Diffstat (limited to 'test/functional/lua/overrides_spec.lua')
-rw-r--r--test/functional/lua/overrides_spec.lua16
1 files changed, 6 insertions, 10 deletions
diff --git a/test/functional/lua/overrides_spec.lua b/test/functional/lua/overrides_spec.lua
index 849978f080..33a2813200 100644
--- a/test/functional/lua/overrides_spec.lua
+++ b/test/functional/lua/overrides_spec.lua
@@ -134,14 +134,12 @@ describe('print', function()
eq('abc def', exec_capture('lua print("abc", "", "def")'))
end)
it('defers printing in luv event handlers', function()
- exec_lua(
- [[
- local cmd = ...
+ exec_lua(function(cmd)
function test()
local timer = vim.uv.new_timer()
local done = false
timer:start(10, 0, function()
- print("very fast")
+ print('very fast')
timer:close()
done = true
end)
@@ -149,14 +147,12 @@ describe('print', function()
-- loop until we know for sure the callback has been executed
while not done do
os.execute(cmd)
- vim.uv.run("nowait") -- fake os_breakcheck()
+ vim.uv.run('nowait') -- fake os_breakcheck()
end
- print("very slow")
- vim.api.nvim_command("sleep 1m") -- force deferred event processing
+ print('very slow')
+ vim.api.nvim_command('sleep 1m') -- force deferred event processing
end
- ]],
- (is_os('win') and 'timeout 1') or 'sleep 0.1'
- )
+ end, (is_os('win') and 'timeout 1') or 'sleep 0.1')
eq('very slow\nvery fast', exec_capture('lua test()'))
end)