aboutsummaryrefslogtreecommitdiffstats
path: root/tests/mason-core/package
diff options
context:
space:
mode:
authorWilliam Boman <william@redwill.se>2025-02-15 21:00:35 +0100
committerGitHub <noreply@github.com>2025-02-15 21:00:35 +0100
commit3a444cb7b0cee6b1e2ed31b7e76f37509075dc46 (patch)
tree4cfc848de225c78f0b9ff63a64902203b9c043b7 /tests/mason-core/package
parentfix(ui): reposition window if border is different than "none" (#1859) (diff)
downloadmason-3a444cb7b0cee6b1e2ed31b7e76f37509075dc46.tar
mason-3a444cb7b0cee6b1e2ed31b7e76f37509075dc46.tar.gz
mason-3a444cb7b0cee6b1e2ed31b7e76f37509075dc46.tar.bz2
mason-3a444cb7b0cee6b1e2ed31b7e76f37509075dc46.tar.lz
mason-3a444cb7b0cee6b1e2ed31b7e76f37509075dc46.tar.xz
mason-3a444cb7b0cee6b1e2ed31b7e76f37509075dc46.tar.zst
mason-3a444cb7b0cee6b1e2ed31b7e76f37509075dc46.zip
fix: avoid calling vim.fn in fast event (#1878)
Diffstat (limited to 'tests/mason-core/package')
-rw-r--r--tests/mason-core/package/package_spec.lua24
1 files changed, 24 insertions, 0 deletions
diff --git a/tests/mason-core/package/package_spec.lua b/tests/mason-core/package/package_spec.lua
index 2cd47452..a667cc58 100644
--- a/tests/mason-core/package/package_spec.lua
+++ b/tests/mason-core/package/package_spec.lua
@@ -193,4 +193,28 @@ describe("package", function()
end)
end)
)
+
+ it(
+ "should be able to instantiate package outside of main loop",
+ async_test(function()
+ local dummy = registry.get_package "registry"
+
+ -- Move outside the main loop
+ a.wait(function(resolve)
+ local timer = vim.loop.new_timer()
+ timer:start(0, 0, function()
+ timer:close()
+ resolve()
+ end)
+ end)
+
+ assert.is_true(vim.in_fast_event())
+
+ local pkg = assert.is_not.has_error(function()
+ return Pkg.new(dummy.spec)
+ end)
+
+ assert.same(dummy.spec, pkg.spec)
+ end)
+ )
end)