diff options
author | Andrey Makarov <ph.makarov@gmail.com> | 2020-12-19 12:33:10 +0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-12-19 10:33:10 +0100 |
commit | 9674eb3ca67042bb6feb442ce4bcfc64933b5ab4 (patch) | |
tree | fdb5c673186c13cd031d7465377d2f8d857452ab /tests | |
parent | 0b7847ba3cbbc2baaeeedf6bbe66823079686662 (diff) | |
download | Nim-9674eb3ca67042bb6feb442ce4bcfc64933b5ab4.tar.gz |
RST enumlist followup (#16382)
* fix matching of enumerator #) * RST: markdown list with auto-enumerator `1`
Diffstat (limited to 'tests')
-rw-r--r-- | tests/stdlib/trstgen.nim | 42 |
1 files changed, 39 insertions, 3 deletions
diff --git a/tests/stdlib/trstgen.nim b/tests/stdlib/trstgen.nim index f3a8aa59a..85a96056a 100644 --- a/tests/stdlib/trstgen.nim +++ b/tests/stdlib/trstgen.nim @@ -440,13 +440,30 @@ Test1 Check that auto-numbered enumeration lists work. #. string1 + #. string2 + #. string3 + + #) string5 + #) string6 """ let output5 = rstToHtml(input5, {roSupportMarkdown}, defaultConfig()) - assert count(output5, "<ol ") == 1 - assert count(output5, "</ol>") == 1 - assert count(output5, "<li>") == 3 + assert count(output5, "<ol ") == 2 + assert count(output5, "</ol>") == 2 + assert count(output5, "<li>") == 5 + + let input5a = dedent """ + Auto-numbered RST list can start with 1 even when Markdown support is on. + + 1. string1 + #. string2 + #. string3 + """ + let output5a = rstToHtml(input5a, {roSupportMarkdown}, defaultConfig()) + assert count(output5a, "<ol ") == 1 + assert count(output5a, "</ol>") == 1 + assert count(output5a, "<li>") == 3 let input6 = dedent """ ... And for alphabetic enumerators too! @@ -474,6 +491,25 @@ Test1 assert count(output7, "<li>") == 3 assert "start=\"3\"" in output7 and "class=\"upperalpha simple\"" in output7 + test "Markdown enumerated lists": + let input1 = dedent """ + Below are 2 enumerated lists: Markdown-style (5 items) and RST (1 item) + 1. line1 + 1. line2 + 1. line3 + 1. line4 + + 1. line5 + + #. lineA + """ + let output1 = rstToHtml(input1, {roSupportMarkdown}, defaultConfig()) + for i in 1..5: + assert ($i & ". line" & $i) notin output1 + assert ("<li>line" & $i & "</li>") in output1 + assert count(output1, "<ol ") == 2 + assert count(output1, "</ol>") == 2 + test "RST bullet lists": let input1 = dedent """ * line1 |