test(treesitter): fix obsolete predicates

This commit is contained in:
Christian Clason 2024-02-21 19:58:17 +01:00
parent ba0370b1d7
commit 8ab9966939
2 changed files with 5 additions and 5 deletions

View File

@ -676,11 +676,11 @@ describe('treesitter highlighting (C)', function()
local parser = vim.treesitter.get_parser(0, "c") local parser = vim.treesitter.get_parser(0, "c")
test_hl = vim.treesitter.highlighter.new(parser, {queries = {c = [[ test_hl = vim.treesitter.highlighter.new(parser, {queries = {c = [[
("static" @keyword ("static" @keyword
(set! conceal "R")) (#set! conceal "R"))
((identifier) @Identifier ((identifier) @Identifier
(set! conceal "") (#set! conceal "")
(eq? @Identifier "lstate")) (#eq? @Identifier "lstate"))
]]}}) ]]}})
]=] ]=]

View File

@ -174,7 +174,7 @@ void ui_refresh(void)
end) end)
local test_query = [[ local test_query = [[
((call_expression function: (identifier) @minfunc (argument_list (identifier) @min_id)) (eq? @minfunc "MIN")) ((call_expression function: (identifier) @minfunc (argument_list (identifier) @min_id)) (#eq? @minfunc "MIN"))
"for" @keyword "for" @keyword
(primitive_type) @type (primitive_type) @type
(field_expression argument: (identifier) @fieldarg) (field_expression argument: (identifier) @fieldarg)
@ -886,7 +886,7 @@ end]]
local parser = vim.treesitter.get_string_parser(str, "c") local parser = vim.treesitter.get_string_parser(str, "c")
local nodes = {} local nodes = {}
local query = vim.treesitter.query.parse("c", '((identifier) @id (eq? @id "foo"))') local query = vim.treesitter.query.parse("c", '((identifier) @id (#eq? @id "foo"))')
for _, node in query:iter_captures(parser:parse()[1]:root(), str) do for _, node in query:iter_captures(parser:parse()[1]:root(), str) do
table.insert(nodes, { node:range() }) table.insert(nodes, { node:range() })