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()
This commit is contained in:
Justin M. Keyes
2020-09-12 19:04:22 -07:00
committed by TJ DeVries
parent aad7a74053
commit 8e77d70e29
9 changed files with 190 additions and 103 deletions

View File

@@ -15,14 +15,14 @@ before_each(clear)
describe('treesitter API', function()
-- error tests not requiring a parser library
it('handles missing language', function()
eq("Error executing lua: .../language.lua: no parser for 'borklang' language, see :help treesitter-parsers",
eq("Error executing lua: .../language.lua:0: no parser for 'borklang' language, see :help treesitter-parsers",
pcall_err(exec_lua, "parser = vim.treesitter.get_parser(0, 'borklang')"))
-- actual message depends on platform
matches("Error executing lua: Failed to load parser: uv_dlopen: .+",
pcall_err(exec_lua, "parser = vim.treesitter.require_language('borklang', 'borkbork.so')"))
eq("Error executing lua: .../language.lua: no parser for 'borklang' language, see :help treesitter-parsers",
eq("Error executing lua: .../language.lua:0: no parser for 'borklang' language, see :help treesitter-parsers",
pcall_err(exec_lua, "parser = vim.treesitter.inspect_language('borklang')"))
end)