diff options
Diffstat (limited to 'tests')
| -rw-r--r-- | tests/core/functional/list_spec.lua | 8 | ||||
| -rw-r--r-- | tests/core/functional/string_spec.lua | 5 | ||||
| -rw-r--r-- | tests/core/managers/luarocks_spec.lua | 52 |
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) |
