aboutsummaryrefslogtreecommitdiffstats
path: root/tests/query/highlights_spec.lua
diff options
context:
space:
mode:
authorStephan Seitz <stephan.seitz@fau.de>2022-01-07 20:04:21 +0100
committerStephan Seitz <stephan.seitz@fau.de>2022-01-16 17:16:54 +0100
commitdada29a1e5ab458f3493e9e1175fe29a3aa341fb (patch)
tree4190ef7e68ec38eaf471100016a55e3366215f1e /tests/query/highlights_spec.lua
parenthighlights(rust): add "yield" keyword (diff)
downloadnvim-treesitter-dada29a1e5ab458f3493e9e1175fe29a3aa341fb.tar
nvim-treesitter-dada29a1e5ab458f3493e9e1175fe29a3aa341fb.tar.gz
nvim-treesitter-dada29a1e5ab458f3493e9e1175fe29a3aa341fb.tar.bz2
nvim-treesitter-dada29a1e5ab458f3493e9e1175fe29a3aa341fb.tar.lz
nvim-treesitter-dada29a1e5ab458f3493e9e1175fe29a3aa341fb.tar.xz
nvim-treesitter-dada29a1e5ab458f3493e9e1175fe29a3aa341fb.tar.zst
nvim-treesitter-dada29a1e5ab458f3493e9e1175fe29a3aa341fb.zip
fix(ci): make highlight test working with markdown
Diffstat (limited to 'tests/query/highlights_spec.lua')
-rw-r--r--tests/query/highlights_spec.lua16
1 files changed, 15 insertions, 1 deletions
diff --git a/tests/query/highlights_spec.lua b/tests/query/highlights_spec.lua
index ca573e086..29bfc7c8d 100644
--- a/tests/query/highlights_spec.lua
+++ b/tests/query/highlights_spec.lua
@@ -4,6 +4,10 @@ local utils = require "nvim-treesitter.utils"
local ts_utils = require "nvim-treesitter.ts_utils"
local parsers = require "nvim-treesitter.parsers"
+local COMMENT_NODES = {
+ markdown = "html_block",
+}
+
local function check_assertions(file)
local buf = vim.fn.bufadd(file)
vim.fn.bufload(file)
@@ -14,15 +18,25 @@ local function check_assertions(file)
'"highlight-assertions" not executable!'
.. ' Get it via "cargo install --git https://github.com/theHamsta/highlight-assertions"'
)
+ local comment_node = COMMENT_NODES[lang] or "comment"
local assertions = vim.fn.json_decode(
vim.fn.system(
- "highlight-assertions -p '" .. utils.get_parser_install_dir() .. "/" .. lang .. ".so'" .. " -s '" .. file .. "'"
+ "highlight-assertions -p '"
+ .. utils.get_parser_install_dir()
+ .. "/"
+ .. lang
+ .. ".so'"
+ .. " -s '"
+ .. file
+ .. "' -c "
+ .. comment_node
)
)
local parser = parsers.get_parser(buf, lang)
local self = highlighter.new(parser, {})
+ assert.True(#assertions > 0, "No assertions detected!")
for _, assertion in ipairs(assertions) do
local row = assertion.position.row
local col = assertion.position.column