aboutsummaryrefslogtreecommitdiff
path: root/plugins/gfm/src/test
diff options
context:
space:
mode:
Diffstat (limited to 'plugins/gfm/src/test')
-rw-r--r--plugins/gfm/src/test/kotlin/renderers/gfm/CodeWrappingTest.kt39
1 files changed, 37 insertions, 2 deletions
diff --git a/plugins/gfm/src/test/kotlin/renderers/gfm/CodeWrappingTest.kt b/plugins/gfm/src/test/kotlin/renderers/gfm/CodeWrappingTest.kt
index ce0c3d0c..a8b263eb 100644
--- a/plugins/gfm/src/test/kotlin/renderers/gfm/CodeWrappingTest.kt
+++ b/plugins/gfm/src/test/kotlin/renderers/gfm/CodeWrappingTest.kt
@@ -25,14 +25,32 @@ class CodeWrappingTest : GfmRenderingOnlyTestBase() {
}
@Test
+ fun `should preserve original text without escaping`() {
+ val page = testPage {
+ codeBlock {
+ text("<----> **text** & ~~this~~ and \"that\"")
+ }
+ }
+ val expect = """|//[testPage](test-page.md)
+ |
+ |```kotlin
+ |<----> **text** & ~~this~~ and "that"
+ |```""".trimMargin()
+
+ CommonmarkRenderer(context).render(page)
+ assertEquals(expect, renderedContent)
+ }
+
+
+ @Test
fun wrappedInlineCode() {
val page = testPage {
text("This function adds the values of ")
- codeInline("") {
+ codeInline {
text("left")
}
text(" and ")
- codeInline("") {
+ codeInline {
text("right")
}
text(".\nBoth numbers must be finite, or an exception occurs.\n")
@@ -45,4 +63,21 @@ class CodeWrappingTest : GfmRenderingOnlyTestBase() {
CommonmarkRenderer(context).render(page)
assertEquals(expect, renderedContent)
}
+
+ @Test
+ fun `should not add trailing backslash to newline elements for code inline code`() {
+ val page = testPage {
+ text("This adds some symbols (")
+ codeInline {
+ text("<----> **text** & ~~this~~ and \"that\"")
+ }
+ text(") to the test")
+ }
+ val expect = """|//[testPage](test-page.md)
+ |
+ |This adds some symbols (`<----> **text** & ~~this~~ and "that"`) to the test""".trimMargin()
+
+ CommonmarkRenderer(context).render(page)
+ assertEquals(expect, renderedContent)
+ }
}