aboutsummaryrefslogtreecommitdiffstats
path: root/tests/core
diff options
context:
space:
mode:
authorWilliam Boman <william@redwill.se>2022-05-27 16:23:51 +0200
committerGitHub <noreply@github.com>2022-05-27 16:23:51 +0200
commitb7813e1ac72271edbb78916d2e87d94a6b0f4039 (patch)
tree4132329e3e3fbf1170501234f0048c971c442fd2 /tests/core
parentrun autogen_metadata.lua (diff)
downloadmason-b7813e1ac72271edbb78916d2e87d94a6b0f4039.tar
mason-b7813e1ac72271edbb78916d2e87d94a6b0f4039.tar.gz
mason-b7813e1ac72271edbb78916d2e87d94a6b0f4039.tar.bz2
mason-b7813e1ac72271edbb78916d2e87d94a6b0f4039.tar.lz
mason-b7813e1ac72271edbb78916d2e87d94a6b0f4039.tar.xz
mason-b7813e1ac72271edbb78916d2e87d94a6b0f4039.tar.zst
mason-b7813e1ac72271edbb78916d2e87d94a6b0f4039.zip
feat: add teal_ls (#724)
Closes #723.
Diffstat (limited to 'tests/core')
-rw-r--r--tests/core/functional/list_spec.lua8
-rw-r--r--tests/core/functional/string_spec.lua5
-rw-r--r--tests/core/managers/luarocks_spec.lua52
3 files changed, 65 insertions, 0 deletions
diff --git a/tests/core/functional/list_spec.lua b/tests/core/functional/list_spec.lua
index 7fa644f2..5d90650a 100644
--- a/tests/core/functional/list_spec.lua
+++ b/tests/core/functional/list_spec.lua
@@ -94,4 +94,12 @@ describe("functional: list", function()
it("should concat strings", function()
assert.equals("FooBar", _.concat("Foo", "Bar"))
end)
+
+ it("should zip list into table", function()
+ local fnkey = function() end
+ assert.same({
+ a = "a",
+ [fnkey] = 1,
+ }, _.zip_table({ "a", fnkey }, { "a", 1 }))
+ end)
end)
diff --git a/tests/core/functional/string_spec.lua b/tests/core/functional/string_spec.lua
index 53575ce4..e24819d9 100644
--- a/tests/core/functional/string_spec.lua
+++ b/tests/core/functional/string_spec.lua
@@ -14,4 +14,9 @@ describe("functional: string", function()
assert.equals("Hello World!", _.format("%s", "Hello World!"))
assert.equals("special manouvers", _.format("%s manouvers", "special"))
end)
+
+ it("should split strings", function()
+ assert.same({ "This", "is", "a", "sentence" }, _.split("%s", "This is a sentence"))
+ assert.same({ "This", "is", "a", "sentence" }, _.split("|", "This|is|a|sentence"))
+ end)
end)
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)