aboutsummaryrefslogtreecommitdiffstats
path: root/tests/core/managers/luarocks_spec.lua
diff options
context:
space:
mode:
Diffstat (limited to 'tests/core/managers/luarocks_spec.lua')
-rw-r--r--tests/core/managers/luarocks_spec.lua109
1 files changed, 0 insertions, 109 deletions
diff --git a/tests/core/managers/luarocks_spec.lua b/tests/core/managers/luarocks_spec.lua
deleted file mode 100644
index a7091e51..00000000
--- a/tests/core/managers/luarocks_spec.lua
+++ /dev/null
@@ -1,109 +0,0 @@
-local installer = require "mason.core.installer"
-local luarocks = require "mason.core.managers.luarocks"
-local path = require "mason.core.path"
-
-describe("luarocks manager", function()
- it(
- "should install provided package",
- async_test(function()
- local handle = InstallHandleGenerator "dummy"
- local ctx = InstallContextGenerator(handle)
- installer.run_installer(ctx, luarocks.package "lua-cjson")
- assert.spy(ctx.spawn.luarocks).was_called(1)
- print(vim.inspect(ctx.spawn.luarocks))
- assert.spy(ctx.spawn.luarocks).was_called_with {
- "install",
- "--tree",
- path.package_prefix "dummy",
- vim.NIL, -- --dev flag
- "lua-cjson",
- vim.NIL, -- version
- }
- end)
- )
-
- it(
- "should install provided version",
- async_test(function()
- local handle = InstallHandleGenerator "dummy"
- local ctx = InstallContextGenerator(handle, { requested_version = "1.2.3" })
- installer.run_installer(ctx, luarocks.package "lua-cjson")
- assert.spy(ctx.spawn.luarocks).was_called(1)
- assert.spy(ctx.spawn.luarocks).was_called_with {
- "install",
- "--tree",
- path.package_prefix "dummy",
- vim.NIL, -- --dev flag
- "lua-cjson",
- "1.2.3",
- }
- end)
- )
-
- it(
- "should provide --dev flag",
- async_test(function()
- local handle = InstallHandleGenerator "dummy"
- local ctx = InstallContextGenerator(handle)
- installer.run_installer(ctx, luarocks.package("lua-cjson", { dev = true }))
- assert.spy(ctx.spawn.luarocks).was_called(1)
- assert.spy(ctx.spawn.luarocks).was_called_with {
- "install",
- "--tree",
- path.package_prefix "dummy",
- "--dev",
- "lua-cjson",
- vim.NIL, -- version
- }
- end)
- )
-
- it("should parse outdated luarocks", function()
- assert.same(
- {
- {
- name = "lua-cjson",
- installed = "2.1.0-1",
- available = "2.1.0.6-1",
- repo = "https://luarocks.org",
- },
- {
- name = "lua-resty-influx-mufanh",
- installed = "0.2.1-0",
- available = "0.2.1-1",
- repo = "https://luarocks.org",
- },
- },
- luarocks.parse_outdated_rocks [[lua-cjson 2.1.0-1 2.1.0.6-1 https://luarocks.org
-lua-resty-influx-mufanh 0.2.1-0 0.2.1-1 https://luarocks.org]]
- )
- end)
-
- it("should parse listed luarocks", function()
- assert.same(
- {
- {
- package = "lua-cjson",
- version = "2.1.0-1",
- arch = "installed",
- nrepo = "/my/luarock/loc",
- },
- {
- package = "lua-resty-http",
- version = "0.17.0.beta.1-0",
- arch = "installed",
- nrepo = "/my/luarock/loc",
- },
- {
- package = "lua-resty-influx-mufanh",
- version = "0.2.1-0",
- arch = "installed",
- nrepo = "/my/luarock/loc",
- },
- },
- luarocks.parse_installed_rocks [[lua-cjson 2.1.0-1 installed /my/luarock/loc
-lua-resty-http 0.17.0.beta.1-0 installed /my/luarock/loc
-lua-resty-influx-mufanh 0.2.1-0 installed /my/luarock/loc]]
- )
- end)
-end)