aboutsummaryrefslogtreecommitdiff
path: root/plugins/base/src/test/kotlin/markdown
diff options
context:
space:
mode:
authorVadim Mishenev <vad-mishenev@yandex.ru>2022-08-30 16:17:54 +0300
committerGitHub <noreply@github.com>2022-08-30 16:17:54 +0300
commitc9f1d60af8776c14d35ed11f512c3c7b0dfad3a2 (patch)
treeb1013542fddd5a3e036161d55da9728ef07e841a /plugins/base/src/test/kotlin/markdown
parenta4bccbf8920a2f6f5fcf5bdf1f201d1129a05b62 (diff)
downloaddokka-c9f1d60af8776c14d35ed11f512c3c7b0dfad3a2.tar.gz
dokka-c9f1d60af8776c14d35ed11f512c3c7b0dfad3a2.tar.bz2
dokka-c9f1d60af8776c14d35ed11f512c3c7b0dfad3a2.zip
Fix missing space between Markdown elements (#2640)
Diffstat (limited to 'plugins/base/src/test/kotlin/markdown')
-rw-r--r--plugins/base/src/test/kotlin/markdown/ParserTest.kt53
1 files changed, 51 insertions, 2 deletions
diff --git a/plugins/base/src/test/kotlin/markdown/ParserTest.kt b/plugins/base/src/test/kotlin/markdown/ParserTest.kt
index 3498f73f..8e813eba 100644
--- a/plugins/base/src/test/kotlin/markdown/ParserTest.kt
+++ b/plugins/base/src/test/kotlin/markdown/ParserTest.kt
@@ -2,16 +2,18 @@ package org.jetbrains.dokka.tests
import markdown.KDocTest
import org.intellij.markdown.MarkdownElementTypes
+import org.jetbrains.dokka.base.parsers.MarkdownParser
import org.jetbrains.dokka.model.doc.*
import org.junit.jupiter.api.Disabled
import org.junit.jupiter.api.Test
-import org.junit.jupiter.api.assertThrows
import kotlin.test.assertEquals
-import kotlin.test.assertTrue
class ParserTest : KDocTest() {
+ private fun parseMarkdownToDocNode(text: String) =
+ MarkdownParser( { null }, "").parseStringToDocNode(text)
+
@Test
fun `Simple text`() {
val kdoc = """
@@ -1519,5 +1521,52 @@ class ParserTest : KDocTest() {
)
executeTest(kdoc, expectedDocumentationNode)
}
+
+ @Test
+ fun `code with backticks`() {
+ val kdoc = "` `` ` ` ``` `"
+ val expectedDocumentationNode = DocumentationNode(
+ listOf(
+ Description(
+ CustomDocTag(
+ listOf(
+ P(
+ listOf(
+ CodeInline(listOf(Text("`` "))),
+ Text(" "),
+ CodeInline(listOf(Text("``` "))),
+ )
+ )
+ ), name = MarkdownElementTypes.MARKDOWN_FILE.name
+ )
+ )
+ )
+ )
+ executeTest(kdoc, expectedDocumentationNode)
+ }
+
+ @Test
+ fun `should filter spaces in markdown`() {
+ val markdown = """
+ | sdsdds f,*()hhh
+ | dssd hf
+ |
+ | sdsdsds sdd
+ |
+ |
+ | eweww
+ |
+ |
+ |
+ """.trimMargin()
+ val actualDocumentationNode = parseMarkdownToDocNode(markdown).children
+ val expectedDocumentationNode = listOf(
+ P(listOf(Text(" sdsdds f,*()hhh dssd hf"))),
+ P(listOf(Text(" sdsdsds sdd"))),
+ P(listOf(Text(" eweww ")))
+ )
+ print(expectedDocumentationNode)
+ assertEquals(actualDocumentationNode, expectedDocumentationNode)
+ }
}