treesitter: Use excplicit names in tests

This commit is contained in:
Thomas Vigouroux 2020-09-01 13:24:59 +02:00 committed by Björn Linse
parent 20c1526552
commit dc579c420b

View File

@ -250,13 +250,13 @@ void ui_refresh(void)
}, res) }, res)
end) end)
it('allow loading query with escaped quotes and capture them with `match?` and `vim-match?`', function() it('allow loading query with escaped quotes and capture them with `lua-match?` and `vim-match?`', function()
if not check_parser() then return end if not check_parser() then return end
insert('char* astring = "Hello World!";') insert('char* astring = "Hello World!";')
local res = exec_lua([[ local res = exec_lua([[
cquery = vim.treesitter.parse_query("c", '((_) @quote (vim-match? @quote "^\\"$")) ((_) @quote (match? @quote "^\\"$"))') cquery = vim.treesitter.parse_query("c", '((_) @quote (vim-match? @quote "^\\"$")) ((_) @quote (lua-match? @quote "^\\"$"))')
parser = vim.treesitter.get_parser(0, "c") parser = vim.treesitter.get_parser(0, "c")
tree = parser:parse() tree = parser:parse()
res = {} res = {}
@ -373,7 +373,7 @@ static int nlua_schedule(lua_State *const lstate)
; Use lua regexes ; Use lua regexes
((identifier) @Identifier (#contains? @Identifier "lua_")) ((identifier) @Identifier (#contains? @Identifier "lua_"))
((identifier) @Constant (#match? @Constant "^[A-Z_]+$")) ((identifier) @Constant (#lua-match? @Constant "^[A-Z_]+$"))
((identifier) @Normal (#vim-match? @Constant "^lstate$")) ((identifier) @Normal (#vim-match? @Constant "^lstate$"))
((binary_expression left: (identifier) @WarningMsg.left right: (identifier) @WarningMsg.right) (#eq? @WarningMsg.left @WarningMsg.right)) ((binary_expression left: (identifier) @WarningMsg.left right: (identifier) @WarningMsg.right) (#eq? @WarningMsg.left @WarningMsg.right))