Diff options
| author | Bryce Kwon <bryce@brycekwon.com> | |
|---|---|---|
| committer | Bryce Kwon <bryce@brycekwon.com> | |
| commit | ||
| parent | ||
| tree | ||
| download | ||
Check the two fallbacks around rendering a readme
Diffstat (limited to 'tests/extensions')
| -rw-r--r-- | tests/extensions/test-about-render.lua | 13 |
1 file changed, 13 insertions, 0 deletions
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, "<p>body</p>") +-- 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", "<x>") +h.equals("a failed parse falls back to plain text", out, "<pre class='plaintext'><x></pre>") +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, "<div class='markdown'><h1 id='a'>a</h1></div>") +h.equals("and close answers zero after it", ret, 0) + h.finish() |
