diff options
Diffstat (limited to 'tests/stdlib')
-rw-r--r-- | tests/stdlib/trst.nim | 63 | ||||
-rw-r--r-- | tests/stdlib/trstgen.nim | 2 |
2 files changed, 59 insertions, 6 deletions
diff --git a/tests/stdlib/trst.nim b/tests/stdlib/trst.nim index 818f8b8dc..3575d17aa 100644 --- a/tests/stdlib/trst.nim +++ b/tests/stdlib/trst.nim @@ -7,6 +7,8 @@ discard """ [Suite] RST indentation +[Suite] Markdown indentation + [Suite] Warnings [Suite] RST include directive @@ -124,12 +126,12 @@ suite "RST parsing": check(dedent""" Paragraph:: - >x""".toAst == expected) + >x""".toAst(rstOptions = preferRst) == expected) check(dedent""" Paragraph:: - >x""".toAst == expected) + >x""".toAst(rstOptions = preferRst) == expected) test "RST quoted literal blocks, :: at a separate line": let expected = @@ -148,7 +150,7 @@ suite "RST parsing": :: >x - >>y""".toAst == expected) + >>y""".toAst(rstOptions = preferRst) == expected) check(dedent""" Paragraph @@ -156,7 +158,7 @@ suite "RST parsing": :: >x - >>y""".toAst == expected) + >>y""".toAst(rstOptions = preferRst) == expected) test "Markdown quoted blocks": check(dedent""" @@ -779,7 +781,7 @@ suite "RST parsing": code - """.toAst == + """.toAst(rstOptions = preferRst) == dedent""" rnInner rnLeaf 'Check' @@ -788,6 +790,32 @@ suite "RST parsing": rnLeaf 'code' """) + test "Markdown indented code blocks": + check(dedent""" + See + + some code""".toAst == + dedent""" + rnInner + rnInner + rnLeaf 'See' + rnLiteralBlock + rnLeaf 'some code' + """) + + # not a code block -- no blank line before: + check(dedent""" + See + some code""".toAst == + dedent""" + rnInner + rnLeaf 'See' + rnLeaf ' ' + rnLeaf 'some' + rnLeaf ' ' + rnLeaf 'code' + """) + suite "RST tables": test "formatting in tables works": @@ -1238,6 +1266,31 @@ suite "RST indentation": rnLeaf 'term3definition2' """) +suite "Markdown indentation": + test "Markdown paragraph indentation": + # Additional spaces (<=3) of indentation does not break the paragraph. + # TODO: in 2nd case de-indentation causes paragraph to break, this is + # reasonable but does not seem to conform the Markdown spec. + check(dedent""" + Start1 + stop1 + + Start2 + stop2 + """.toAst == + dedent""" + rnInner + rnParagraph + rnLeaf 'Start1' + rnLeaf ' ' + rnLeaf 'stop1' + rnParagraph + rnLeaf 'Start2' + rnParagraph + rnLeaf 'stop2' + rnLeaf ' ' + """) + suite "Warnings": test "warnings for broken footnotes/links/substitutions": let input = dedent""" diff --git a/tests/stdlib/trstgen.nim b/tests/stdlib/trstgen.nim index b33ee82a8..a25d903db 100644 --- a/tests/stdlib/trstgen.nim +++ b/tests/stdlib/trstgen.nim @@ -632,7 +632,7 @@ Test literal block :: check """ - let output1 = input1.toHtml + let output1 = input1.toHtml(preferRst) doAssert "<pre>" in output1 test "Markdown code block": |