aboutsummaryrefslogtreecommitdiff
path: root/plugins/base/src/test/kotlin/markdown
diff options
context:
space:
mode:
Diffstat (limited to 'plugins/base/src/test/kotlin/markdown')
-rw-r--r--plugins/base/src/test/kotlin/markdown/ParserTest.kt119
1 files changed, 118 insertions, 1 deletions
diff --git a/plugins/base/src/test/kotlin/markdown/ParserTest.kt b/plugins/base/src/test/kotlin/markdown/ParserTest.kt
index e127afc2..268af405 100644
--- a/plugins/base/src/test/kotlin/markdown/ParserTest.kt
+++ b/plugins/base/src/test/kotlin/markdown/ParserTest.kt
@@ -1169,7 +1169,7 @@ class ParserTest : KDocTest() {
}
@Test
- fun image(){
+ fun image() {
val kdoc = "![Sample image](https://www.google.pl/images/branding/googlelogo/1x/googlelogo_color_272x92dp.png)"
val expectedDocumentationNode = DocumentationNode(
listOf(
@@ -1190,5 +1190,122 @@ class ParserTest : KDocTest() {
)
executeTest(kdoc, expectedDocumentationNode)
}
+
+ @Test
+ fun `Bold + italic + link`() {
+ val kdoc = "It's very easy to make some words **bold** and other words *italic* with Markdown.\n" +
+ "You can even [link to Google!](http://google.com)"
+ val expectedDocumentationNode = DocumentationNode(
+ listOf(
+ Description(
+ P(
+ listOf(
+ Text("It's very easy to make some words "),
+ B(listOf(Text("bold"))),
+ Text(" and other words "),
+ I(listOf(Text("italic"))),
+ Text(" with Markdown. You can even "),
+ A(listOf(Text("link to Google!")), mapOf("href" to "http://google.com"))
+ )
+ )
+ )
+ )
+ )
+ executeTest(kdoc, expectedDocumentationNode)
+ }
+
+ @Test
+ fun `Codeblock from indent`() {
+ val kdoc = "Here is some example how to use conditional instructions:\n\n" +
+ " val x = 1\n" +
+ " val y = 2\n" +
+ " if (x == 1) {\n" +
+ " println(y)\n" +
+ " }"
+ val expectedDocumentationNode = DocumentationNode(
+ listOf(
+ Description(
+ P(
+ listOf(
+ P(listOf(Text("Here is some example how to use conditional instructions:"))),
+ CodeBlock(
+ listOf(
+ Text(
+ " val x = 1\n" +
+ " val y = 2\n" +
+ " if (x == 1) {\n" +
+ " println(y)\n" +
+ " }"
+ )
+ )
+ )
+ )
+ )
+ )
+ )
+ )
+ executeTest(kdoc, expectedDocumentationNode)
+ }
+
+ @Test
+ fun `Table`() {
+ val kdoc = "First Header | Second Header\n" +
+ "------------ | -------------\n" +
+ "Content from cell 1 | Content from cell 2\n" +
+ "Content in the first column | Content in the second column"
+ val expectedDocumentationNode = DocumentationNode(
+ listOf(
+ Description(
+ Table(
+ listOf(
+ Th(
+ listOf(
+ Td(
+ listOf(
+ Text("First Header")
+ )
+ ),
+ Td(
+ listOf(
+ Text("Second Header")
+ )
+ )
+ )
+ ),
+ Tr(
+ listOf(
+ Td(
+ listOf(
+ Text("Content from cell 1")
+ )
+ ),
+ Td(
+ listOf(
+ Text("Content from cell 2")
+ )
+ )
+ )
+ ),
+ Tr(
+ listOf(
+ Td(
+ listOf(
+ Text("Content in the first column")
+ )
+ ),
+ Td(
+ listOf(
+ Text("Content in the second column")
+ )
+ )
+ )
+ )
+ )
+ )
+ )
+ )
+ )
+ executeTest(kdoc, expectedDocumentationNode)
+ }
}