package org.jetbrains.dokka.tests
import markdown.KDocTest
import org.jetbrains.dokka.model.doc.*
import org.junit.jupiter.api.Disabled
import org.junit.jupiter.api.Test
class ParserTest : KDocTest() {
@Test
fun `Simple text`() {
val kdoc = """
| This is simple test of string
| Next line
""".trimMargin()
val expectedDocumentationNode = DocumentationNode(
listOf(
Description(
P(listOf(Text("This is simple test of string Next line")))
)
)
)
executeTest(kdoc, expectedDocumentationNode)
}
@Test
fun `Simple text with new line`() {
val kdoc = """
| This is simple test of string\
| Next line
""".trimMargin()
val expectedDocumentationNode = DocumentationNode(
listOf(
Description(
P(
listOf(
Text("This is simple test of string"),
Br,
Text("Next line")
)
)
)
)
)
executeTest(kdoc, expectedDocumentationNode)
}
@Test
fun `Text with Bold and Emphasis decorators`() {
val kdoc = """
| This is **simple** test of _string_
| Next **_line_**
""".trimMargin()
val expectedDocumentationNode = DocumentationNode(
listOf(
Description(
P(
listOf(
Text("This is "),
B(listOf(Text("simple"))),
Text(" test of "),
I(listOf(Text("string"))),
Text(" Next "),
B(listOf(I(listOf(Text("line")))))
)
)
)
)
)
executeTest(kdoc, expectedDocumentationNode)
}
@Test
fun `Text with Colon`() {
val kdoc = """
| This is simple text with: colon!
""".trimMargin()
val expectedDocumentationNode = DocumentationNode(
listOf(
Description(
P(listOf(Text("This is simple text with: colon!")))
)
)
)
executeTest(kdoc, expectedDocumentationNode)
}
@Test
fun `Multilined text`() {
val kdoc = """
| Text
| and
| String
""".trimMargin()
val expectedDocumentationNode = DocumentationNode(
listOf(
Description(
P(listOf(Text("Text and String")))
)
)
)
executeTest(kdoc, expectedDocumentationNode)
}
@Test
fun `Paragraphs`() {
val kdoc = """
| Paragraph number
| one
|
| Paragraph\
| number two
""".trimMargin()
val expectedDocumentationNode = DocumentationNode(
listOf(
Description(
P(
listOf(
P(listOf(Text("Paragraph number one"))),
P(listOf(Text("Paragraph"), Br, Text("number two")))
)
)
)
)
)
executeTest(kdoc, expectedDocumentationNode)
}
@Test
fun `Emphasis with star`() {
val kdoc = " *text*"
val expectedDocumentationNode = DocumentationNode(
listOf(
Description(
P(listOf(I(listOf(Text("text")))))
)
)
)
executeTest(kdoc, expectedDocumentationNode)
}
@Test
fun `Underscores that are not Emphasis`() {
val kdoc = "text_with_underscores"
val expectedDocumentationNode = DocumentationNode(
listOf(
Description(