diff options
Diffstat (limited to '')
| -rw-r--r-- | tests/extensions/test-about-render.lua | 29 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
1 file changed, 21 insertions, 8 deletions
diff --git a/tests/extensions/test-about-render.lua b/tests/extensions/test-about-render.lua index 3925dfd..cb1c736 100644 --- a/tests/extensions/test-about-render.lua +++ b/tests/extensions/test-about-render.lua @@ -73,19 +73,31 @@ end -- Markdown. out = render("README.md", "# Title") -h.contains("a heading renders inside the wrapper", out, "<div class='markdown'><h1>Title</h1></div>") +h.contains("a heading renders inside the wrapper", out, "<div class='markdown'><h1 id='title'>Title</h1></div>") out = render("README.md", "## Sub ##") -h.contains("trailing hashes are stripped from a heading", out, "<h2>Sub</h2>") +h.contains("trailing hashes are stripped from a heading", out, "<h2 id='sub'>Sub</h2>") out = render("README.md", "# C#") -h.contains("a hash ending a word stays in the heading", out, "<h1>C#</h1>") +h.contains("a hash ending a word stays in the heading", out, "<h1 id='c'>C#</h1>") + +out = render("README.md", "## The `run` [Command](x), Again!") +h.contains("an anchor is the heading's text in lower case", out, "<h2 id='the-run-command-again'>") + +out = render("README.md", "# Twice\n# Twice\n# twice") +h.contains("a repeated anchor is counted", out, "<h1 id='twice'>Twice</h1><h1 id='twice-1'>Twice</h1><h1 id='twice-2'>") + +out = render("README.md", "# About") +h.contains("no heading takes an id of the page", out, "<h1 id='about-1'>") + +out = render("README.md", "# ???") +h.contains("a heading of punctuation gets no anchor", out, "<h1>???</h1>") out = render("README.MD", "# Upper") -h.contains("the extension matches whatever its case", out, "<h1>Upper</h1>") +h.contains("the extension matches whatever its case", out, "<h1 id='upper'>Upper</h1>") out = render("readme.markdown", "# Long") -h.contains("the long markdown extension dispatches too", out, "<h1>Long</h1>") +h.contains("the long markdown extension dispatches too", out, "<h1 id='long'>Long</h1>") out = render("README.md", "line one\nline two") h.contains("the lines of a paragraph run together", out, "<p>line one\nline two</p>") @@ -241,6 +253,7 @@ h.check("an emphasis bomb still renders something", #out > 0) -- request for minutes. Both lines below took seconds before. local started = os.clock() render("README.md", "# a" .. string.rep(" ", 3000) .. "b") +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 < 1) @@ -281,13 +294,13 @@ h.contains("an oversized readme renders as plain text", out, "<pre class='plaint -- Man pages. out = render("page.1", ".SH NAME") -h.contains("a section heading renders", out, "<div class='markdown manpage'><h2>NAME</h2></div>") +h.contains("a section heading renders", out, "<div class='markdown manpage'><h2 id='name'>NAME</h2></div>") out = render("page.man", '.SH "TWO WORDS"') -h.contains("a quoted heading argument is unquoted", out, "<h2>TWO WORDS</h2>") +h.contains("a quoted heading argument is unquoted", out, "<h2 id='two-words'>TWO WORDS</h2>") out = render("page.3", ".SS Details") -h.contains("a subsection renders one level down", out, "<h3>Details</h3>") +h.contains("a subsection renders one level down", out, "<h3 id='details'>Details</h3>") out = render("page.1", ".B bold words\nplain after") h.contains("the bold macro renders strong", out, "<p><strong>bold words</strong>\nplain after</p>") |
