From 2437092a411e822a4d7ff822f4cc098571afb663 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micka=C3=ABl=20Canouil?= <8896044+mcanouil@users.noreply.github.com> Date: Thu, 29 Oct 2026 12:22:16 +0100 Subject: [PATCH 1/4] test: print the summary when a module does not load The loading section recorded a failed load and went on, then the first section that used the missing module raised and ended the run with no summary. The suite now stops after loading when a module failed, and prints the summary line through one exit path. --- tests/run.lua | 20 +++++++++++++++++--- 1 file changed, 17 insertions(+), 3 deletions(-) diff --git a/tests/run.lua b/tests/run.lua index 44fcc6d..c9de56b 100644 --- a/tests/run.lua +++ b/tests/run.lua @@ -43,6 +43,15 @@ local function check(ok, description, detail) end end +--- Print the summary line and end the run. A reader, and an agent, tells a +--- load failure from a broad assertion failure by how far the run got, so +--- every way out of the suite goes through here. +local function finish() + io.stdout:write(string.format('\n%d checks, %d failed\n', passed + failed, failed)) + io.stdout:flush() + os.exit(failed == 0 and 0 or 1, true) +end + local function equal(actual, expected, description) check(actual == expected, description, string.format('expected %s, got %s', tostring(expected), tostring(actual))) @@ -109,6 +118,13 @@ for _, name in ipairs(names) do end end +-- Every section below indexes a module it expects to have loaded, so one that +-- did not would end the run mid-section with no summary. +if failed > 0 then + io.stdout:write('\n# stopped: a module did not load, so the sections that use it cannot run\n') + finish() +end + io.stdout:write('# loading from an extension\n') --- The modules as an extension vendors them, in a directory whose path has a @@ -1357,6 +1373,4 @@ do _G.quarto = previous_quarto end -io.stdout:write(string.format('\n%d checks, %d failed\n', passed + failed, failed)) -io.stdout:flush() -os.exit(failed == 0 and 0 or 1, true) +finish() From e0770decf4e8924e212959bc1ed64c3fd91e3438 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micka=C3=ABl=20Canouil?= <8896044+mcanouil@users.noreply.github.com> Date: Thu, 29 Oct 2026 12:24:07 +0100 Subject: [PATCH 2/4] test: say why a module failed its load check A module that loads and returns something other than a table failed the check with no detail and a stop line that said it did not load. Both now say what happened. --- tests/run.lua | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/tests/run.lua b/tests/run.lua index c9de56b..da2f25c 100644 --- a/tests/run.lua +++ b/tests/run.lua @@ -45,7 +45,7 @@ end --- Print the summary line and end the run. A reader, and an agent, tells a --- load failure from a broad assertion failure by how far the run got, so ---- every way out of the suite goes through here. +--- every planned way out of the suite goes through here. local function finish() io.stdout:write(string.format('\n%d checks, %d failed\n', passed + failed, failed)) io.stdout:flush() @@ -112,16 +112,16 @@ local modules = {} for _, name in ipairs(names) do local ok, loaded = pcall(load_module, name) check(ok and type(loaded) == 'table', string.format('`%s` loads and returns a table', name), - not ok and tostring(loaded) or nil) + not ok and tostring(loaded) or ('it returned a ' .. type(loaded))) if ok then modules[name] = loaded end end -- Every section below indexes a module it expects to have loaded, so one that --- did not would end the run mid-section with no summary. +-- failed its load check would end the run mid-section with no summary. if failed > 0 then - io.stdout:write('\n# stopped: a module did not load, so the sections that use it cannot run\n') + io.stdout:write('\n# stopped: a module failed its load check, so the sections that use it cannot run\n') finish() end From 40ab9c455b8888616060f697557e766a6f472ac8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micka=C3=ABl=20Canouil?= <8896044+mcanouil@users.noreply.github.com> Date: Thu, 29 Oct 2026 12:25:35 +0100 Subject: [PATCH 3/4] test: state that stopping after a failed load is deliberate Not every later section indexes a loaded module, so the comment now says the stop is a choice and why. --- tests/run.lua | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/tests/run.lua b/tests/run.lua index da2f25c..198ae6c 100644 --- a/tests/run.lua +++ b/tests/run.lua @@ -118,8 +118,9 @@ for _, name in ipairs(names) do end end --- Every section below indexes a module it expects to have loaded, so one that --- failed its load check would end the run mid-section with no summary. +-- Stop here, on purpose. The sections that follow index the modules that +-- loaded, so one that failed its load check would end the run mid-section +-- with no summary, and the renders after it would only add noise. if failed > 0 then io.stdout:write('\n# stopped: a module failed its load check, so the sections that use it cannot run\n') finish() From 5b1dab39e7453c60bcdebc9365e5c3b035a622ee Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micka=C3=ABl=20Canouil?= <8896044+mcanouil@users.noreply.github.com> Date: Thu, 29 Oct 2026 12:26:46 +0100 Subject: [PATCH 4/4] test: keep the real exit in the summary helper The suite later replaces os.exit with a counting stub, so the helper now holds the real function from the start. --- tests/run.lua | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/tests/run.lua b/tests/run.lua index 198ae6c..da01657 100644 --- a/tests/run.lua +++ b/tests/run.lua @@ -46,10 +46,12 @@ end --- Print the summary line and end the run. A reader, and an agent, tells a --- load failure from a broad assertion failure by how far the run got, so --- every planned way out of the suite goes through here. +local exit = os.exit + local function finish() io.stdout:write(string.format('\n%d checks, %d failed\n', passed + failed, failed)) io.stdout:flush() - os.exit(failed == 0 and 0 or 1, true) + exit(failed == 0 and 0 or 1, true) end local function equal(actual, expected, description)