mirror of
https://github.com/neovim/neovim.git
synced 2025-12-15 19:05:40 +00:00
fix(treesitter): suppress get_parser warnings via opts.error
This commit is contained in:
committed by
Christian Clason
parent
7b71fdbc1e
commit
0f067cd34d
@@ -16,11 +16,11 @@ describe('treesitter language API', function()
|
||||
-- error tests not requiring a parser library
|
||||
it('handles missing language', function()
|
||||
eq(
|
||||
'.../treesitter.lua:0: Parser not found.',
|
||||
'.../treesitter.lua:0: Parser could not be created for buffer 1 and language "borklang"',
|
||||
pcall_err(exec_lua, "parser = vim.treesitter.get_parser(0, 'borklang')")
|
||||
)
|
||||
|
||||
eq(NIL, exec_lua("return vim.treesitter._get_parser(0, 'borklang')"))
|
||||
eq(NIL, exec_lua("return vim.treesitter.get_parser(0, 'borklang', { error = false })"))
|
||||
|
||||
-- actual message depends on platform
|
||||
matches(
|
||||
@@ -108,10 +108,10 @@ describe('treesitter language API', function()
|
||||
command('set filetype=borklang')
|
||||
-- Should throw an error when filetype changes to borklang
|
||||
eq(
|
||||
'.../treesitter.lua:0: Parser not found.',
|
||||
'.../treesitter.lua:0: Parser could not be created for buffer 1 and language "borklang"',
|
||||
pcall_err(exec_lua, "new_parser = vim.treesitter.get_parser(0, 'borklang')")
|
||||
)
|
||||
eq(NIL, exec_lua("return vim.treesitter._get_parser(0, 'borklang')"))
|
||||
eq(NIL, exec_lua("return vim.treesitter.get_parser(0, 'borklang', { error = false })"))
|
||||
end
|
||||
)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user