mirror of
https://github.com/nvim-treesitter/nvim-treesitter.git
synced 2026-07-01 19:17:02 -04:00
test(queries): print ALL errors at end
This commit is contained in:
parent
1ae9b0e455
commit
fc0fceb43a
1 changed files with 9 additions and 12 deletions
|
|
@ -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
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue