aboutsummaryrefslogtreecommitdiffstats
path: root/tests/query/injection_spec.lua
diff options
context:
space:
mode:
authorPham Huy Hoang <hoangtun0810@gmail.com>2023-09-04 16:19:33 +0900
committerChristian Clason <c.clason@uni-graz.at>2025-05-12 18:43:40 +0200
commit3966b8808b36ce263111c7e177b4364d32e67a2d (patch)
tree9f418bf636767f5ec4d375dddfab476e11a39933 /tests/query/injection_spec.lua
parentdocs(readme): document 'location' key (diff)
downloadnvim-treesitter-3966b8808b36ce263111c7e177b4364d32e67a2d.tar
nvim-treesitter-3966b8808b36ce263111c7e177b4364d32e67a2d.tar.gz
nvim-treesitter-3966b8808b36ce263111c7e177b4364d32e67a2d.tar.bz2
nvim-treesitter-3966b8808b36ce263111c7e177b4364d32e67a2d.tar.lz
nvim-treesitter-3966b8808b36ce263111c7e177b4364d32e67a2d.tar.xz
nvim-treesitter-3966b8808b36ce263111c7e177b4364d32e67a2d.tar.zst
nvim-treesitter-3966b8808b36ce263111c7e177b4364d32e67a2d.zip
fix!: indents now rely on treesitter highlight
- Apply suggestions from Lewis to only parse visible lines - Fix failed tests
Diffstat (limited to 'tests/query/injection_spec.lua')
-rw-r--r--tests/query/injection_spec.lua9
1 files changed, 4 insertions, 5 deletions
diff --git a/tests/query/injection_spec.lua b/tests/query/injection_spec.lua
index 91096fee4..e90925e20 100644
--- a/tests/query/injection_spec.lua
+++ b/tests/query/injection_spec.lua
@@ -26,7 +26,6 @@ local function check_assertions(file)
)
local parser = ts.get_parser(buf, lang)
- local self = parser
local top_level_root = parser:parse(true)[1]:root()
for _, assertion in ipairs(assertions) do
@@ -37,7 +36,7 @@ local function check_assertions(file)
assertion.expected_capture_name = neg_assert and assertion.expected_capture_name:sub(2)
or assertion.expected_capture_name
local found = false
- self:for_each_tree(function(tstree, tree)
+ parser:for_each_tree(function(tstree, tree)
if not tstree then
return
end
@@ -50,11 +49,11 @@ local function check_assertions(file)
if assertion.expected_capture_name == tree:lang() then
found = true
end
- end, true)
+ end)
if neg_assert then
assert.False(
found,
- 'Error in at '
+ 'Error in '
.. file
.. ':'
.. (row + 1)
@@ -67,7 +66,7 @@ local function check_assertions(file)
else
assert.True(
found,
- 'Error in at '
+ 'Error in '
.. file
.. ':'
.. (row + 1)