From 719d902b61ad27369a90b4bfdf9a31f651e6fd6e Mon Sep 17 00:00:00 2001 From: Bryce Kwon Date: Sat, 7 Nov 2026 10:19:22 -1000 Subject: Decide every unit check skip in the shell Where a standalone Lua had no lpeg, the harness skipped the markdown and man checks itself, behind a note the test library hides, and the test passed on the six checks left. The real luaossl checks were left out the same way. Each now shows as a skip under a prerequisite named for the interpreter, and a misspelt mode fails rather than running the default. --- tests/extensions/harness.lua | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) (limited to 'tests/extensions/harness.lua') diff --git a/tests/extensions/harness.lua b/tests/extensions/harness.lua index 8c1ba6c..b54f727 100644 --- a/tests/extensions/harness.lua +++ b/tests/extensions/harness.lua @@ -82,6 +82,22 @@ function harness.load(script) dofile(script) end +-- The mode a t05xx script names after the script path, which has to be one +-- of those given, so a misspelt mode fails instead of quietly running +-- another one. Lua 5.1 gives a function taking ... a local arg of its own, +-- nil here, so the script's arguments are read from the global table. +function harness.mode(...) + local known = { ... } + local wanted = _G.arg[2] + for _, mode in ipairs(known) do + if wanted == mode then + return mode + end + end + error("unknown mode " .. tostring(wanted) .. ", wanted one of " .. + table.concat(known, ", ")) +end + -- Load a script with some of its own text replaced first, for checks that -- need the commented-out examples of its configuration switched on. Each -- replacement has to match exactly once, so a reworded example fails here -- cgit 2.12.1