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/test-about-render.lua')
| -rw-r--r-- | tests/extensions/test-about-render.lua | 23 |
1 file changed, 6 insertions, 17 deletions
diff --git a/tests/extensions/test-about-render.lua b/tests/extensions/test-about-render.lua index 98b84b8..e6813ef 100644 --- a/tests/extensions/test-about-render.lua +++ b/tests/extensions/test-about-render.lua @@ -1,25 +1,18 @@ -- Unit checks for custom/extensions/about-render.lua, run under a standalone -- Lua by t0501-about-render.sh with the script path as the first argument. --- The second argument may be nolpeg, which makes the lpeg module fail to --- load so the escaped plain text fallback is proven even on a machine where --- lpeg is installed. Without it the markdown and man checks run when lpeg is --- present and are skipped with a note when it is not, the same way the --- filter itself degrades. +-- The second argument is the mode. In lpeg mode, which t0501 asks for only +-- where the interpreter has lpeg, the markdown and man checks run. In nolpeg +-- mode the lpeg module fails to load, so the escaped plain text fallback is +-- proven even on a machine where lpeg is installed. local test_directory = arg[0]:match("^(.*)/") or "." local h = dofile(test_directory .. "/harness.lua") local script = arg[1] -local mode = arg[2] or "" +local mode = h.mode("lpeg", "nolpeg") -local has_lpeg = false if mode == "nolpeg" then h.preload_failure("lpeg") -else - has_lpeg = pcall(require, "lpeg") - if not has_lpeg then - io.write("lpeg not installed, markdown and man checks skipped\n") - end end h.load(script) @@ -27,7 +20,7 @@ h.load(script) -- A missing lpeg is written to the error log as the script loads. if mode == "nolpeg" then h.contains("a missing lpeg is named in the error log", h.error_log(), "Unable to load lpeg") -elseif has_lpeg then +else h.equals("with lpeg the error log stays empty", h.error_log(), "") end @@ -72,10 +65,6 @@ if mode == "nolpeg" then h.finish() end -if not has_lpeg then - h.finish() -end - -- Markdown. out = render("README.md", "# Title") |
