mirror of
https://github.com/nvim-treesitter/nvim-treesitter.git
synced 2026-07-01 19:17:02 -04:00
ci(injection tests): don't consider root language an injection
This commit is contained in:
parent
a3862c9802
commit
881cb5b8f2
2 changed files with 8 additions and 1 deletions
|
|
@ -22,6 +22,7 @@ local function check_assertions(file)
|
|||
local parser = parsers.get_parser(buf, lang)
|
||||
|
||||
local self = highlighter.new(parser, {})
|
||||
local top_level_root = parser:parse()[1]:root()
|
||||
|
||||
for _, assertion in ipairs(assertions) do
|
||||
local row = assertion.position.row
|
||||
|
|
@ -34,7 +35,11 @@ local function check_assertions(file)
|
|||
end
|
||||
|
||||
local root = tstree:root()
|
||||
if ts_utils.is_in_node_range(root, row, col) and assertion.expected_capture_name == tree:lang() then
|
||||
if
|
||||
ts_utils.is_in_node_range(root, row, col)
|
||||
and assertion.expected_capture_name == tree:lang()
|
||||
and root ~= top_level_root
|
||||
then
|
||||
found = true
|
||||
end
|
||||
end, true)
|
||||
|
|
|
|||
2
tests/query/injections/cuda/macro-self-injection.cu
Normal file
2
tests/query/injections/cuda/macro-self-injection.cu
Normal file
|
|
@ -0,0 +1,2 @@
|
|||
#define FOO(X,Y) X + Y
|
||||
// ^ cuda
|
||||
Loading…
Add table
Add a link
Reference in a new issue