aboutsummaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorWilliam Boman <william@redwill.se>2022-05-27 19:35:47 +0200
committerWilliam Boman <william@redwill.se>2022-05-27 19:35:47 +0200
commit5061e9fe9557cdf4530cdda5989e5dddf6161fce (patch)
tree3d10123e8d6c2a23cb71b5b0c62607208bc65e24 /tests
parentfeat: add teal_ls (#724) (diff)
downloadmason-5061e9fe9557cdf4530cdda5989e5dddf6161fce.tar
mason-5061e9fe9557cdf4530cdda5989e5dddf6161fce.tar.gz
mason-5061e9fe9557cdf4530cdda5989e5dddf6161fce.tar.bz2
mason-5061e9fe9557cdf4530cdda5989e5dddf6161fce.tar.lz
mason-5061e9fe9557cdf4530cdda5989e5dddf6161fce.tar.xz
mason-5061e9fe9557cdf4530cdda5989e5dddf6161fce.tar.zst
mason-5061e9fe9557cdf4530cdda5989e5dddf6161fce.zip
test(luarocks): add more test cases
Diffstat (limited to 'tests')
-rw-r--r--tests/core/managers/luarocks_spec.lua48
1 files changed, 48 insertions, 0 deletions
diff --git a/tests/core/managers/luarocks_spec.lua b/tests/core/managers/luarocks_spec.lua
index f2836a3f..359f3b4c 100644
--- a/tests/core/managers/luarocks_spec.lua
+++ b/tests/core/managers/luarocks_spec.lua
@@ -1,6 +1,54 @@
+local mock = require "luassert.mock"
+local installer = require "nvim-lsp-installer.core.installer"
local luarocks = require "nvim-lsp-installer.core.managers.luarocks"
+local Optional = require "nvim-lsp-installer.core.optional"
describe("luarocks manager", function()
+ ---@type InstallContext
+ local ctx
+ before_each(function()
+ ctx = InstallContextGenerator {
+ spawn = mock.new {
+ luarocks = mockx.returns {},
+ },
+ }
+ end)
+
+ it(
+ "install provided package",
+ async_test(function()
+ 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",
+ "--dev",
+ "--tree",
+ "/tmp/install-dir",
+ "lua-cjson",
+ vim.NIL,
+ }
+ end)
+ )
+
+ it(
+ "install provided version",
+ async_test(function()
+ ctx.requested_version = Optional.of "1.2.3"
+ 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",
+ "--dev",
+ "--tree",
+ "/tmp/install-dir",
+ "lua-cjson",
+ "1.2.3",
+ }
+ end)
+ )
+
it("should parse outdated luarocks", function()
assert.same(
{