From 8e77d70e29f936f4e708ee3244046188b8ad0383 Mon Sep 17 00:00:00 2001 From: "Justin M. Keyes" Date: Sat, 12 Sep 2020 19:04:22 -0700 Subject: test/vim.validate(): assert normalized stacktrace - The previous commit lost information in the tests. Instead, add some more "normalization" substitutions in pcall_err(), so that the general shape of the stacktrace is included in the asserted text. - Eliminate contains(), it is redundant with matches() --- test/functional/plugin/lsp_spec.lua | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) (limited to 'test/functional/plugin') diff --git a/test/functional/plugin/lsp_spec.lua b/test/functional/plugin/lsp_spec.lua index 3c4c448e7a..f07a2d18a2 100644 --- a/test/functional/plugin/lsp_spec.lua +++ b/test/functional/plugin/lsp_spec.lua @@ -6,7 +6,6 @@ local buf_lines = helpers.buf_lines local dedent = helpers.dedent local exec_lua = helpers.exec_lua local eq = helpers.eq -local contains = helpers.contains local pcall_err = helpers.pcall_err local pesc = helpers.pesc local insert = helpers.insert @@ -748,8 +747,16 @@ describe('LSP', function() end) it('should invalid cmd argument', function() - contains('cmd: expected list, got nvim', pcall_err(_cmd_parts, "nvim")) - contains('cmd argument: expected string, got number', pcall_err(_cmd_parts, {"nvim", 1})) + eq(dedent([[ + Error executing lua: .../lsp.lua:0: cmd: expected list, got nvim + stack traceback: + .../lsp.lua:0: in function .../lsp.lua:0>]]), + pcall_err(_cmd_parts, 'nvim')) + eq(dedent([[ + Error executing lua: .../lsp.lua:0: cmd argument: expected string, got number + stack traceback: + .../lsp.lua:0: in function .../lsp.lua:0>]]), + pcall_err(_cmd_parts, {'nvim', 1})) end) end) end) -- cgit