diff options
| author | William Boman <william@redwill.se> | 2021-12-25 21:47:57 +0100 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2021-12-25 21:47:57 +0100 |
| commit | 5957e7a29005c286eaf2cc619e826cfd980eb5ff (patch) | |
| tree | 8fb998c67cdb195ad68813498cace7ef64044a8c /tests/ui_status_win_spec.lua | |
| parent | fix(zls): add chmod +x to binary (#362) (diff) | |
| download | mason-5957e7a29005c286eaf2cc619e826cfd980eb5ff.tar mason-5957e7a29005c286eaf2cc619e826cfd980eb5ff.tar.gz mason-5957e7a29005c286eaf2cc619e826cfd980eb5ff.tar.bz2 mason-5957e7a29005c286eaf2cc619e826cfd980eb5ff.tar.lz mason-5957e7a29005c286eaf2cc619e826cfd980eb5ff.tar.xz mason-5957e7a29005c286eaf2cc619e826cfd980eb5ff.tar.zst mason-5957e7a29005c286eaf2cc619e826cfd980eb5ff.zip | |
feat(ui): sort servers alphabetically, also add language hints (#361)
Diffstat (limited to 'tests/ui_status_win_spec.lua')
| -rw-r--r-- | tests/ui_status_win_spec.lua | 49 |
1 files changed, 49 insertions, 0 deletions
diff --git a/tests/ui_status_win_spec.lua b/tests/ui_status_win_spec.lua new file mode 100644 index 00000000..01f06c3a --- /dev/null +++ b/tests/ui_status_win_spec.lua @@ -0,0 +1,49 @@ +local ServerHints = require "nvim-lsp-installer.ui.status-win.server_hints" + +describe("status win server hints", function() + it("should produce valid server hints", function() + local srv = ServerGenerator { + name = "rust_analyzer", + languages = { "rust", "analyz", "totallynotjavascript" }, + } + local hints = ServerHints.new(srv) + assert.equal(vim.inspect { "analyz", "totallynotjavascript" }, vim.inspect(hints:get_hints())) + assert.equal("(analyz, totallynotjavascript)", tostring(hints)) + end) + + it("should not produce server hints", function() + local srv = ServerGenerator { + name = "rust_analyzer", + languages = { "rust" }, + } + local srv2 = ServerGenerator { + name = "cssmodules_ls", + languages = { "css" }, + } + local hints = ServerHints.new(srv) + assert.equal(vim.inspect {}, vim.inspect(hints:get_hints())) + assert.equal("", tostring(hints)) + + local hints2 = ServerHints.new(srv2) + assert.equal(vim.inspect {}, vim.inspect(hints2:get_hints())) + assert.equal("", tostring(hints2)) + end) + + it("should produce server hints even when there's a match if language is short or long", function() + local srv = ServerGenerator { + name = "clangd", + languages = { "c", "c++" }, + } + local srv2 = ServerGenerator { + name = "this_is_a_very_cool_rust_server", + languages = { "rust" }, + } + local hints = ServerHints.new(srv) + assert.equal(vim.inspect { "c", "c++" }, vim.inspect(hints:get_hints())) + assert.equal("(c, c++)", tostring(hints)) + + local hints2 = ServerHints.new(srv2) + assert.equal(vim.inspect { "rust" }, vim.inspect(hints2:get_hints())) + assert.equal("(rust)", tostring(hints2)) + end) +end) |
