From 3515ff2e921e05c9a262e5c0470a17fb2f7480c9 Mon Sep 17 00:00:00 2001 From: Bryce Kwon Date: Sat, 7 Nov 2026 10:31:58 -1000 Subject: Check the two fallbacks around rendering a readme --- tests/extensions/test-about-render.lua | 13 +++++++++++++ 1 file changed, 13 insertions(+) (limited to 'tests/extensions') diff --git a/tests/extensions/test-about-render.lua b/tests/extensions/test-about-render.lua index 7d714c3..8c37f30 100644 --- a/tests/extensions/test-about-render.lua +++ b/tests/extensions/test-about-render.lua @@ -462,4 +462,17 @@ out = render("page.1", ".TH title 1\nbody") h.excludes("the title macro renders nothing itself", out, "title 1") h.contains("the body after it renders", out, "

body

") +-- A parse that fails falls back to escaped plain text, and an emit that +-- fails part way still closes the wrapper, so neither ends the request in +-- an error. These load a broken copy of the script, so they come last. +h.load_with(script, { { "local function parse_man(text)", "local function parse_man(text) error('boom')" } }) +out, ret = render("page.1", "") +h.equals("a failed parse falls back to plain text", out, "
<x>
") +h.equals("and close still answers zero", ret, 0) + +h.load_with(script, { { "elseif kind == \"hr\" then", "elseif kind == \"hr\" then error('boom')" } }) +out, ret = render("README.md", "# a\n\n---\n\nb") +h.equals("a failed emit still closes the wrapper", out, "

a

") +h.equals("and close answers zero after it", ret, 0) + h.finish() -- cgit 2.12.1