aboutsummaryrefslogtreecommitdiffstats
path: root/scripts/check-queries.lua
diff options
context:
space:
mode:
authorChristian Clason <c.clason@uni-graz.at>2024-01-04 19:18:49 +0100
committerChristian Clason <c.clason@uni-graz.at>2024-01-19 16:58:37 +0100
commitfc0fceb43a8a6dee9ffa669de8b641493e64c276 (patch)
tree4a7437ea1cb48c6ae5398af8dc1118b0aea1ca7c /scripts/check-queries.lua
parentfeat!: align standard captures with upstream (diff)
downloadnvim-treesitter-fc0fceb43a8a6dee9ffa669de8b641493e64c276.tar
nvim-treesitter-fc0fceb43a8a6dee9ffa669de8b641493e64c276.tar.gz
nvim-treesitter-fc0fceb43a8a6dee9ffa669de8b641493e64c276.tar.bz2
nvim-treesitter-fc0fceb43a8a6dee9ffa669de8b641493e64c276.tar.lz
nvim-treesitter-fc0fceb43a8a6dee9ffa669de8b641493e64c276.tar.xz
nvim-treesitter-fc0fceb43a8a6dee9ffa669de8b641493e64c276.tar.zst
nvim-treesitter-fc0fceb43a8a6dee9ffa669de8b641493e64c276.zip
test(queries): print ALL errors at end
Diffstat (limited to 'scripts/check-queries.lua')
-rwxr-xr-xscripts/check-queries.lua21
1 files changed, 9 insertions, 12 deletions
diff --git a/scripts/check-queries.lua b/scripts/check-queries.lua
index a84df85c4..959969645 100755
--- a/scripts/check-queries.lua
+++ b/scripts/check-queries.lua
@@ -51,7 +51,7 @@ local function do_check()
local query_types = queries.built_in_query_groups
local captures = extract_captures()
- local last_error
+ local errors = {}
io_print "::group::Check parsers"
@@ -66,8 +66,7 @@ local function do_check()
io_print("Checking " .. lang .. " " .. query_type .. string.format(" (%.02fms)", duration * 1e-6))
if not ok then
local err_msg = lang .. " (" .. query_type .. "): " .. query
- io_print(err_msg)
- last_error = err_msg
+ errors[#errors + 1] = err_msg
else
if query then
for _, capture in ipairs(query.captures) do
@@ -79,8 +78,7 @@ local function do_check()
)
if not is_valid then
local error = string.format("(x) Invalid capture @%s in %s for %s.", capture, query_type, lang)
- io_print(error)
- last_error = error
+ errors[#errors + 1] = error
end
end
end
@@ -90,10 +88,12 @@ local function do_check()
io_print "::endgroup::"
- if last_error then
- io_print()
- io_print "Last error: "
- error(last_error)
+ if #errors > 0 then
+ io_print "\nCheck failed!\nErrors:"
+ for _, err in ipairs(errors) do
+ print(err)
+ end
+ error()
end
return timings
end
@@ -129,8 +129,5 @@ if ok then
io_print "Check successful!"
vim.cmd "q"
else
- io_print "Check failed:"
- io_print(result)
- io_print "\n"
vim.cmd "cq"
end