Diff options
Diffstat (limited to '')
-rw-r--r--tests/extensions/test-about-render.lua71
1 file changed, 69 insertions, 2 deletions
diff --git a/tests/extensions/test-about-render.lua b/tests/extensions/test-about-render.lua
index 0571796..88c136c 100644
--- a/tests/extensions/test-about-render.lua
+++ b/tests/extensions/test-about-render.lua
@@ -257,6 +257,15 @@ render("README.md", string.rep("# a\n", 50000))
render("README.md", "| a | b |\n|---|---|\n| x" .. string.rep(" ", 40000) .. "y | z |")
h.check("a long run of spaces is trimmed quickly", os.clock() - started < 10)
+-- The long forms of the man escapes scan for a closing bracket or quote, so
+-- they are bounded the same way, and a line of openers stays linear.
+started = os.clock()
+render("page.1", string.rep("\\[", 100000))
+render("page.1", string.rep("\\f[", 100000))
+render("page.1", string.rep("\\h'", 100000))
+render("page.1", string.rep("\\s[", 100000))
+h.check("a line of unclosed man escapes renders quickly", os.clock() - started < 10)
+
out = render("README.md", "Title\n=====\n\nBody")
h.contains("equals signs under a line make a heading", out, "<h1 id='title'>Title</h1><p>Body</p>")
@@ -334,13 +343,71 @@ h.contains("the bold macro renders strong", out, "<p><strong>bold words</strong>
out = render("page.1", "a \\fBbold\\fR c")
h.contains("font escapes carry across a run", out, "<p>a <strong>bold</strong> c</p>")
-out = render("page.1", "x \\(em y \\- z")
-h.contains("character escapes are translated", out, "<p>x - y - z</p>")
+out = render("page.1", "x \\(em y \\- z \\(bu \\[co]")
+h.contains("character escapes are translated", out, "<p>x — y - z • ©</p>")
+
+out = render("page.1", "\\*(lqquoted\\*(rq\\*R")
+h.contains("predefined strings are expanded", out, "<p>“quoted”®</p>")
+
+out = render("page.1", "a\\%b c\\:d \\s-1SMALL\\s0 text \\\" a comment")
+h.contains("escapes that only steer the layout draw nothing", out, "<p>ab cd SMALL text </p>")
out = render("page.1", ".nf\ncode <x>\n.fi\nafter")
h.contains("a no fill block renders as code", out, "<pre><code>code &lt;x&gt;\n</code></pre>")
h.contains("filling resumes after it", out, "<p>after</p>")
+out = render("page.1", ".nf\n\\fBgit\\fR \\-\\-version\n.fi")
+h.contains("a no fill block shows the text of its escapes", out, "<pre><code>git --version\n</code></pre>")
+
+out = render("page.1", ".EX\nline <one>\n.EE")
+h.contains("an example block renders as code", out, "<pre><code>line &lt;one&gt;\n</code></pre>")
+
+out = render("page.1", ".TP\n.B \\-v\nBe verbose.")
+h.contains("a tag takes a line of its own", out, "<p><strong>-v</strong><br>\nBe verbose.</p>")
+
+out = render("page.1", ".IP \\(bu 2\nAn item.\n.IP \\-v 4\nA flag.")
+h.contains("a bullet leads its item", out, "<p>• \nAn item.</p>")
+h.contains("a longer tag takes a line of its own", out, "<p>-v<br>\nA flag.</p>")
+
+out = render("page.1", ".BR ls (1),\n.IR file .txt")
+h.contains("alternating macros switch fonts between arguments", out,
+ "<strong>ls</strong>(1),\n<em>file</em>.txt")
+
+out = render("page.1", '.B "two words" three')
+h.contains("a quoted argument keeps its blank", out, "<strong>two words three</strong>")
+
+out = render("page.1", "one\n.br\ntwo\n.\nthree")
+h.contains("a break request breaks the line", out, "<p>one<br>\ntwo\nthree</p>")
+
+-- pod2man and asciidoctor open their pages with macro definitions and
+-- conditional requests, none of which may reach the page as text.
+out = render("page.1", table.concat({
+ ".de Vb", ".nf", "..", ".de IX", "..", ".if n .ds Aq '", ".ie \\n(.g \\{\\",
+ ". nr x 1", ".\\}", ".SH NAME", ".IX Header \"NAME\"", ".Vb 2", "\\& code", ".Ve", "after",
+}, "\n"))
+h.excludes("a page's own macro is not drawn", out, "Header")
+h.excludes("a roff request is not drawn", out, "Aq")
+h.contains("the heading after the preamble renders", out, "<h2 id='name'>NAME</h2>")
+h.contains("pod2man's verbatim macros render code", out, "<pre><code> code\n</code></pre>")
+h.contains("text after the definitions renders", out, "<p>after</p>")
+
+out = render("page.1", ".if n \\\n\\{\\\n.ds x y\n.\\}\nafter")
+h.contains("a conditional block's requests and braces draw nothing", out,
+ "<div class='markdown manpage'><p>after</p></div>")
+
+out = render("page.1", "The \\m[blue]\\fBManual\\fR\\m[]\\s-2\\u[1]\\d\\s+2 here")
+h.contains("DocBook's link colours and footnote marks draw nothing", out,
+ "<p>The <strong>Manual</strong>[1] here</p>")
+
+out = render("page.1", ".de x\n.B hidden\n.. \nshown")
+h.contains("a definition ends at two dots with blanks after them", out,
+ "<div class='markdown manpage'><p>shown</p></div>")
+
+out = render("page.1", ".TP\n.PD 0\n.B \\-a\nall\n.PD\nDon\\*(Aqt")
+h.excludes("a spacing macro draws nothing", out, ">0")
+h.contains("DocBook's apostrophe string expands", out, "Don't")
+
+
out = render("page.1", '.\\" a comment\nvisible')
h.excludes("a roff comment is dropped", out, "comment")
h.contains("the line after it renders", out, "visible")