aboutsummaryrefslogtreecommitdiff
path: root/test/functional/treesitter/query_spec.lua
diff options
context:
space:
mode:
authorRiley Bruins <ribru17@hotmail.com>2024-10-02 10:34:14 -0700
committerChristian Clason <c.clason@uni-graz.at>2024-10-11 17:29:45 +0200
commit267c7525f738cdd6024c39da758e885c026ffaaa (patch)
tree869fcb5fa87b4f9b2c4f0a0295498c5ed2883b73 /test/functional/treesitter/query_spec.lua
parentc4762b309714897615607f135aab9d7bcc763c4f (diff)
downloadrneovim-267c7525f738cdd6024c39da758e885c026ffaaa.tar.gz
rneovim-267c7525f738cdd6024c39da758e885c026ffaaa.tar.bz2
rneovim-267c7525f738cdd6024c39da758e885c026ffaaa.zip
feat(treesitter): introduce child_with_descendant()
This commit also marks `child_containing_descendant()` as deprecated (per upstream's documentation), and uses `child_with_descendant()` in its place. Minimum required tree-sitter version will now be `0.24`.
Diffstat (limited to 'test/functional/treesitter/query_spec.lua')
-rw-r--r--test/functional/treesitter/query_spec.lua14
1 files changed, 14 insertions, 0 deletions
diff --git a/test/functional/treesitter/query_spec.lua b/test/functional/treesitter/query_spec.lua
index c97619c913..dfb5eb2685 100644
--- a/test/functional/treesitter/query_spec.lua
+++ b/test/functional/treesitter/query_spec.lua
@@ -405,6 +405,20 @@ void ui_refresh(void)
{ 'literal', 'number_literal', { 0, 8, 0, 11 }, '123' },
{ 'literal', 'number_literal', { 2, 21, 2, 24 }, '125' },
}, result)
+
+ result = exec_lua(
+ get_query_result,
+ [[((number_literal) @literal (#has-ancestor? @literal "enumerator"))]]
+ )
+ eq({
+ { 'literal', 'number_literal', { 1, 13, 1, 16 }, '124' },
+ }, result)
+
+ result = exec_lua(
+ get_query_result,
+ [[((number_literal) @literal (#has-ancestor? @literal "number_literal"))]]
+ )
+ eq({}, result)
end)
it('allows loading query with escaped quotes and capture them `#{lua,vim}-match`?', function()