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.lua52
1 files changed, 52 insertions, 0 deletions
diff --git a/tests/core/managers/luarocks_spec.lua b/tests/core/managers/luarocks_spec.lua
new file mode 100644
index 00000000..f2836a3f
--- /dev/null
+++ b/tests/core/managers/luarocks_spec.lua
@@ -0,0 +1,52 @@
+local luarocks = require "nvim-lsp-installer.core.managers.luarocks"
+
+describe("luarocks manager", function()
+ 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)