aboutsummaryrefslogtreecommitdiffstats
path: root/tests/core
diff options
context:
space:
mode:
authorWilliam Boman <william@redwill.se>2022-05-29 02:38:00 +0200
committerGitHub <noreply@github.com>2022-05-29 02:38:00 +0200
commit3c21304c3f54caf0c00fab00cf1e4e9c0507b5d1 (patch)
tree8c849bca476cf6180fbcd8287adf1f09072a41cc /tests/core
parentrefactor(health): spawn processes via the spawn module (#732) (diff)
downloadmason-3c21304c3f54caf0c00fab00cf1e4e9c0507b5d1.tar
mason-3c21304c3f54caf0c00fab00cf1e4e9c0507b5d1.tar.gz
mason-3c21304c3f54caf0c00fab00cf1e4e9c0507b5d1.tar.bz2
mason-3c21304c3f54caf0c00fab00cf1e4e9c0507b5d1.tar.lz
mason-3c21304c3f54caf0c00fab00cf1e4e9c0507b5d1.tar.xz
mason-3c21304c3f54caf0c00fab00cf1e4e9c0507b5d1.tar.zst
mason-3c21304c3f54caf0c00fab00cf1e4e9c0507b5d1.zip
feat(luarocks): use luarocks.bat executable if it's available (#731)
Closes #726.
Diffstat (limited to 'tests/core')
-rw-r--r--tests/core/managers/luarocks_spec.lua32
1 files changed, 21 insertions, 11 deletions
diff --git a/tests/core/managers/luarocks_spec.lua b/tests/core/managers/luarocks_spec.lua
index 20de3719..9c7e9f70 100644
--- a/tests/core/managers/luarocks_spec.lua
+++ b/tests/core/managers/luarocks_spec.lua
@@ -1,8 +1,6 @@
local mock = require "luassert.mock"
-local stub = require "luassert.stub"
local installer = require "nvim-lsp-installer.core.installer"
local luarocks = require "nvim-lsp-installer.core.managers.luarocks"
-local std = require "nvim-lsp-installer.core.managers.std"
local Optional = require "nvim-lsp-installer.core.optional"
describe("luarocks manager", function()
@@ -17,42 +15,54 @@ describe("luarocks manager", function()
end)
it(
- "install provided package",
+ "should install provided package",
async_test(function()
- stub(std, "ensure_executable")
- std.ensure_executable.returns()
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",
- "--dev",
"--tree",
"/tmp/install-dir",
+ vim.NIL, -- --dev flag
"lua-cjson",
- vim.NIL,
+ vim.NIL, -- version
}
end)
)
it(
- "install provided version",
+ "should install provided version",
async_test(function()
- stub(std, "ensure_executable")
- std.ensure_executable.returns()
ctx.requested_version = Optional.of "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",
- "--dev",
"--tree",
"/tmp/install-dir",
+ vim.NIL, -- --dev flag
"lua-cjson",
"1.2.3",
}
end)
)
+ it(
+ "should provide --dev flag",
+ async_test(function()
+ 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",
+ "/tmp/install-dir",
+ "--dev",
+ "lua-cjson",
+ vim.NIL, -- version
+ }
+ end)
+ )
+
it("should parse outdated luarocks", function()
assert.same(
{