diff options
Diffstat (limited to 'core/src/test')
-rw-r--r-- | core/src/test/kotlin/TestAPI.kt | 5 | ||||
-rw-r--r-- | core/src/test/kotlin/format/HtmlFormatTest.kt | 4 | ||||
-rw-r--r-- | core/src/test/kotlin/model/CommentTest.kt | 62 |
3 files changed, 49 insertions, 22 deletions
diff --git a/core/src/test/kotlin/TestAPI.kt b/core/src/test/kotlin/TestAPI.kt index e13a61f8..43a335fc 100644 --- a/core/src/test/kotlin/TestAPI.kt +++ b/core/src/test/kotlin/TestAPI.kt @@ -175,7 +175,10 @@ fun StringBuilder.appendNode(node: ContentNode): StringBuilder { } is ContentEmphasis -> append("*").appendChildren(node).append("*") is ContentBlockCode -> { - appendln("[code]") + if (node.language.isNotBlank()) + appendln("[code lang=${node.language}]") + else + appendln("[code]") appendChildren(node) appendln() appendln("[/code]") diff --git a/core/src/test/kotlin/format/HtmlFormatTest.kt b/core/src/test/kotlin/format/HtmlFormatTest.kt index 2f92366b..12df7c44 100644 --- a/core/src/test/kotlin/format/HtmlFormatTest.kt +++ b/core/src/test/kotlin/format/HtmlFormatTest.kt @@ -76,6 +76,10 @@ class HtmlFormatTest { } } + @Test fun codeBlock() { + verifyHtmlNode("codeBlock") + } + @Test fun javaLinkTag() { verifyJavaHtmlNode("javaLinkTag") } diff --git a/core/src/test/kotlin/model/CommentTest.kt b/core/src/test/kotlin/model/CommentTest.kt index 457affee..55fa3fc0 100644 --- a/core/src/test/kotlin/model/CommentTest.kt +++ b/core/src/test/kotlin/model/CommentTest.kt @@ -5,6 +5,26 @@ import org.junit.Assert.* import org.jetbrains.dokka.* public class CommentTest { + + @Test fun codeBlockComment() { + verifyModel("testdata/comments/codeBlockComment.kt") { model -> + with(model.members.single().members.first()) { + assertEquals("""[code lang=brainfuck] + |++++++++++[>+++++++>++++++++++>+++>+<<<<-]>++.>+.+++++++..+++.>++.<<+++++++++++++++.>.+++.------.--------.>+.>. + |[/code] + |""".trimMargin(), + content.toTestString()) + } + with(model.members.single().members.last()) { + assertEquals("""[code] + |a + b - c + |[/code] + |""".trimMargin(), + content.toTestString()) + } + } + } + @Test fun emptyDoc() { verifyModel("testdata/comments/emptyDoc.kt") { model -> with(model.members.single().members.single()) { @@ -133,27 +153,27 @@ line two""", toTestString()) with(model.members.single().members.first()) { assertEquals("Summary", content.summary.toTestString()) with (content.description) { - assertEqualsIgnoringSeparators("""[code] -if (true) { - println(property) -} -[/code] -[code] -if (true) { - println(property) -} -[/code] -[code] -if (true) { - println(property) -} -[/code] -[code] -if (true) { - println(property) -} -[/code] -""", toTestString()) + assertEqualsIgnoringSeparators("""[code lang=kotlin] + |if (true) { + | println(property) + |} + |[/code] + |[code lang=kotlin] + |if (true) { + | println(property) + |} + |[/code] + |[code lang=kotlin] + |if (true) { + | println(property) + |} + |[/code] + |[code lang=kotlin] + |if (true) { + | println(property) + |} + |[/code] + |""".trimMargin(), toTestString()) } } } |