Diff options
| author | Bryce Kwon <bryce@brycekwon.com> | |
|---|---|---|
| committer | Bryce Kwon <bryce@brycekwon.com> | |
| commit | ||
| parent | ||
| tree | ||
| download | ||
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.
Diffstat (limited to 'tests/extensions/harness.lua')
| -rw-r--r-- | tests/extensions/harness.lua | 16 |
1 file changed, 16 insertions, 0 deletions
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 |
