From fc0fceb43a8a6dee9ffa669de8b641493e64c276 Mon Sep 17 00:00:00 2001 From: Christian Clason Date: Thu, 4 Jan 2024 19:18:49 +0100 Subject: test(queries): print ALL errors at end --- scripts/check-queries.lua | 21 +++++++++------------ 1 file changed, 9 insertions(+), 12 deletions(-) (limited to 'scripts/check-queries.lua') 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 -- cgit v1.2.3-70-g09d2