diff options
| author | William Boman <william@redwill.se> | 2025-05-02 03:52:10 +0200 |
|---|---|---|
| committer | William Boman <william@redwill.se> | 2025-05-02 03:57:07 +0200 |
| commit | 4da89f3ab04783da990f9bd40aaa36c22e59375b (patch) | |
| tree | bb672a1bd796a6adf3d04473cb66a3e90be00707 /tests/mason-registry/sources/lua_spec.lua | |
| parent | feat(ui): display purl information (diff) | |
| download | mason-4da89f3ab04783da990f9bd40aaa36c22e59375b.tar mason-4da89f3ab04783da990f9bd40aaa36c22e59375b.tar.gz mason-4da89f3ab04783da990f9bd40aaa36c22e59375b.tar.bz2 mason-4da89f3ab04783da990f9bd40aaa36c22e59375b.tar.lz mason-4da89f3ab04783da990f9bd40aaa36c22e59375b.tar.xz mason-4da89f3ab04783da990f9bd40aaa36c22e59375b.tar.zst mason-4da89f3ab04783da990f9bd40aaa36c22e59375b.zip | |
refactor(registry): change lua registries to not instantiate Package themselves
Instead of having Lua registries instantiate package instances
themselves we now do it in the installer of Lua registry sources.
This aligns the behaviour of the Lua registry protocol with the other
registry protocols.
Diffstat (limited to 'tests/mason-registry/sources/lua_spec.lua')
| -rw-r--r-- | tests/mason-registry/sources/lua_spec.lua | 27 |
1 files changed, 10 insertions, 17 deletions
diff --git a/tests/mason-registry/sources/lua_spec.lua b/tests/mason-registry/sources/lua_spec.lua index c720ae10..9e3c8450 100644 --- a/tests/mason-registry/sources/lua_spec.lua +++ b/tests/mason-registry/sources/lua_spec.lua @@ -2,44 +2,37 @@ local LuaRegistrySource = require "mason-registry.sources.lua" describe("Lua registry source", function() it("should get package", function() - package.loaded["pkg-index"] = { - ["my-pkg"] = "pkg-index.my-pkg", - } - package.loaded["pkg-index.my-pkg"] = {} local source = LuaRegistrySource:new { - mod = "pkg-index", + mod = "dummy-registry.index", } - assert.is_not_nil(source:get_package "my-pkg") + assert.is_true(source:install():is_success()) + assert.is_not_nil(source:get_package "dummy") assert.is_nil(source:get_package "non-existent") end) it("should get all package names", function() - package.loaded["pkg-index"] = { - ["my-pkg"] = "pkg-index.my-pkg", - ["rust-analyzer"] = "pkg-index.rust-analyzer", - ["typescript-language-server"] = "pkg-index.typescript-language-server", - } local source = LuaRegistrySource:new { - mod = "pkg-index", + mod = "dummy-registry.index", } + assert.is_true(source:install():is_success()) local package_names = source:get_all_package_names() table.sort(package_names) assert.same({ - "my-pkg", - "rust-analyzer", - "typescript-language-server", + "dummy", + "dummy2", + "registry", }, package_names) end) it("should check if is installed", function() - package.loaded["pkg-index"] = {} local installed_source = LuaRegistrySource:new { - mod = "pkg-index", + mod = "dummy-registry.index", } local uninstalled_source = LuaRegistrySource:new { mod = "non-existent", } + assert.is_true(installed_source:install():is_success()) assert.is_true(installed_source:is_installed()) assert.is_false(uninstalled_source:is_installed()) end) |
