From 12d97eeabf44c2dd2cf841db218aac449022143d Mon Sep 17 00:00:00 2001 From: William Boman Date: Mon, 21 Feb 2022 20:56:16 +0100 Subject: feat: add async module (#499) --- tests/luassertx/lua/luassertx.lua | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) (limited to 'tests/luassertx/lua/luassertx.lua') diff --git a/tests/luassertx/lua/luassertx.lua b/tests/luassertx/lua/luassertx.lua index 33fa9957..0722a6d7 100644 --- a/tests/luassertx/lua/luassertx.lua +++ b/tests/luassertx/lua/luassertx.lua @@ -1,6 +1,17 @@ -local a = require "plenary.async" +local a = require "nvim-lsp-installer.core.async" local assert = require "luassert" +local util = require "luassert.util" + +function async_test(suspend_fn) + return function() + local ok, err = pcall(a.run_blocking, suspend_fn) + if not ok then + error(err, util.errorlevel()) + end + end +end + local function wait_for(_, arguments) ---@type fun() @Function to execute until it does not error. local assertions_fn = arguments[1] @@ -13,7 +24,7 @@ local function wait_for(_, arguments) repeat is_ok, err = pcall(assertions_fn) if not is_ok then - a.util.sleep(math.min(timeout, 100)) + a.sleep(math.min(timeout, 100)) end until is_ok or ((vim.loop.hrtime() - start) / 1e6) > timeout -- cgit v1.2.3-70-g09d2