aboutsummaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorRiley Bruins <ribru17@hotmail.com>2024-11-08 11:42:09 -0800
committerChristian Clason <ch.clason+github@icloud.com>2024-11-13 13:32:58 +0100
commit36990f324de2cfb96a6d2450e9c3ddfc3fba8afa (patch)
tree1d29fc8d7d2166b0c2f890399d3a275065bc9ec9 /test
parent37f665c504e499c95bc0a88c52dd38ca9f621cdd (diff)
downloadrneovim-36990f324de2cfb96a6d2450e9c3ddfc3fba8afa.tar.gz
rneovim-36990f324de2cfb96a6d2450e9c3ddfc3fba8afa.tar.bz2
rneovim-36990f324de2cfb96a6d2450e9c3ddfc3fba8afa.zip
fix(treesitter): show proper node name error messages
**Problem:** Currently node names with non-alphanumeric, non underscore/hyphen characters (only possible with anonymous nodes) are not given a proper error message. See tree-sitter issue 3892 for more details. **Solution:** Apply a different scanning logic to anonymous nodes to correctly identify the entire node name (i.e., up until the final double quote)
Diffstat (limited to 'test')
-rw-r--r--test/functional/treesitter/query_spec.lua20
1 files changed, 19 insertions, 1 deletions
diff --git a/test/functional/treesitter/query_spec.lua b/test/functional/treesitter/query_spec.lua
index dfb5eb2685..634f8af83d 100644
--- a/test/functional/treesitter/query_spec.lua
+++ b/test/functional/treesitter/query_spec.lua
@@ -722,7 +722,25 @@ void ui_refresh(void)
eq(exp, pcall_err(exec_lua, "vim.treesitter.query.parse('c', ...)", cquery))
end
- -- Invalid node type
+ -- Invalid node types
+ test(
+ '.../query.lua:0: Query error at 1:2. Invalid node type ">\\">>":\n'
+ .. '">\\">>" @operator\n'
+ .. ' ^',
+ '">\\">>" @operator'
+ )
+ test(
+ '.../query.lua:0: Query error at 1:2. Invalid node type "\\\\":\n'
+ .. '"\\\\" @operator\n'
+ .. ' ^',
+ '"\\\\" @operator'
+ )
+ test(
+ '.../query.lua:0: Query error at 1:2. Invalid node type ">>>":\n'
+ .. '">>>" @operator\n'
+ .. ' ^',
+ '">>>" @operator'
+ )
test(
'.../query.lua:0: Query error at 1:2. Invalid node type "dentifier":\n'
.. '(dentifier) @variable\n'