diff options
author | Hirokazu Hata <h.hata.ai.t@gmail.com> | 2020-05-26 21:55:45 +0900 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-05-26 08:55:45 -0400 |
commit | 15b762761ad966f91d452fdd28c718f2fd3e45be (patch) | |
tree | cfd7c1ddd1b868862f571caf491cd9546853ca23 /test/functional | |
parent | 618e9a769220ffe331cc554c51485f9230a544ec (diff) | |
download | rneovim-15b762761ad966f91d452fdd28c718f2fd3e45be.tar.gz rneovim-15b762761ad966f91d452fdd28c718f2fd3e45be.tar.bz2 rneovim-15b762761ad966f91d452fdd28c718f2fd3e45be.zip |
lsp: make the command error message more detailed (#11633)
* lsp.lua: make the error message more detailed
* test: add lsp._cmd_part test
Diffstat (limited to 'test/functional')
-rw-r--r-- | test/functional/plugin/lsp_spec.lua | 18 |
1 files changed, 17 insertions, 1 deletions
diff --git a/test/functional/plugin/lsp_spec.lua b/test/functional/plugin/lsp_spec.lua index f41a5323a8..e39511d0ea 100644 --- a/test/functional/plugin/lsp_spec.lua +++ b/test/functional/plugin/lsp_spec.lua @@ -6,6 +6,7 @@ local buf_lines = helpers.buf_lines local dedent = helpers.dedent local exec_lua = helpers.exec_lua local eq = helpers.eq +local pcall_err = helpers.pcall_err local pesc = helpers.pesc local insert = helpers.insert local retry = helpers.retry @@ -705,7 +706,6 @@ describe('LSP', function() end; } end) - end) describe("parsing tests", function() @@ -733,7 +733,23 @@ describe('LSP', function() end; } end) + end) + describe('lsp._cmd_parts test', function() + local function _cmd_parts(input) + return exec_lua([[ + lsp = require('vim.lsp') + return lsp._cmd_parts(...) + ]], input) + end + it('should valid cmd argument', function() + eq(true, pcall(_cmd_parts, {"nvim"})) + eq(true, pcall(_cmd_parts, {"nvim", "--head"})) + end) + it('should invalid cmd argument', function() + eq('Error executing lua: .../shared.lua: cmd: expected list, got nvim', pcall_err(_cmd_parts, "nvim")) + eq('Error executing lua: .../shared.lua: cmd argument: expected string, got number', pcall_err(_cmd_parts, {"nvim", 1})) + end) end) end) |