diff options
author | Simon Ogorodnik <Simon.Ogorodnik@jetbrains.com> | 2017-02-17 17:40:32 +0300 |
---|---|---|
committer | Simon Ogorodnik <Simon.Ogorodnik@jetbrains.com> | 2017-02-17 17:40:32 +0300 |
commit | 2ceff9c41cff42b7fb3ffe75ea36a7c570f3615b (patch) | |
tree | 4d0f1d9624b02e58f2d608674d3a466f2e1a3c58 /core/src/test/kotlin | |
parent | 994a86700210fe5f26a8bc131815bde2f6269ac5 (diff) | |
download | dokka-2ceff9c41cff42b7fb3ffe75ea36a7c570f3615b.tar.gz dokka-2ceff9c41cff42b7fb3ffe75ea36a7c570f3615b.tar.bz2 dokka-2ceff9c41cff42b7fb3ffe75ea36a7c570f3615b.zip |
Fix for GH-136 GH-137 Blank lines inside code blocks are not preserved
Diffstat (limited to 'core/src/test/kotlin')
-rw-r--r-- | core/src/test/kotlin/format/HtmlFormatTest.kt | 4 | ||||
-rw-r--r-- | core/src/test/kotlin/format/MarkdownFormatTest.kt | 4 | ||||
-rw-r--r-- | core/src/test/kotlin/javadoc/JavadocTest.kt | 19 | ||||
-rw-r--r-- | core/src/test/kotlin/model/CommentTest.kt | 4 |
4 files changed, 31 insertions, 0 deletions
diff --git a/core/src/test/kotlin/format/HtmlFormatTest.kt b/core/src/test/kotlin/format/HtmlFormatTest.kt index 4b4eff59..f2b8624d 100644 --- a/core/src/test/kotlin/format/HtmlFormatTest.kt +++ b/core/src/test/kotlin/format/HtmlFormatTest.kt @@ -138,6 +138,10 @@ class HtmlFormatTest { verifyHtmlNode("functionalTypeWithNamedParameters") } + @Test fun blankLineInsideCodeBlock() { + verifyHtmlNode("blankLineInsideCodeBlock") + } + private fun verifyHtmlNode(fileName: String, withKotlinRuntime: Boolean = false) { verifyHtmlNodes(fileName, withKotlinRuntime) { model -> model.members.single().members } } diff --git a/core/src/test/kotlin/format/MarkdownFormatTest.kt b/core/src/test/kotlin/format/MarkdownFormatTest.kt index f870d898..d788c84d 100644 --- a/core/src/test/kotlin/format/MarkdownFormatTest.kt +++ b/core/src/test/kotlin/format/MarkdownFormatTest.kt @@ -241,6 +241,10 @@ class MarkdownFormatTest { verifyMarkdownPackage("suspendParam") } + @Test fun blankLineInsideCodeBlock() { + verifyMarkdownNode("blankLineInsideCodeBlock") + } + private fun verifyMarkdownPackage(fileName: String, withKotlinRuntime: Boolean = false) { verifyOutput("testdata/format/$fileName.kt", ".package.md", withKotlinRuntime = withKotlinRuntime) { model, output -> markdownService.createOutputBuilder(output, tempLocation).appendNodes(model.members) diff --git a/core/src/test/kotlin/javadoc/JavadocTest.kt b/core/src/test/kotlin/javadoc/JavadocTest.kt index f7f86881..359c5fef 100644 --- a/core/src/test/kotlin/javadoc/JavadocTest.kt +++ b/core/src/test/kotlin/javadoc/JavadocTest.kt @@ -1,7 +1,9 @@ package org.jetbrains.dokka.javadoc +import com.sun.javadoc.Tag import com.sun.javadoc.Type import org.jetbrains.dokka.DokkaConsoleLogger +import org.jetbrains.dokka.tests.assertEqualsIgnoringSeparators import org.jetbrains.dokka.tests.verifyModel import org.junit.Assert.* import org.junit.Test @@ -132,6 +134,23 @@ class JavadocTest { } } + @Test + fun testBlankLineInsideCodeBlock() { + verifyJavadoc("testdata/javadoc/blankLineInsideCodeBlock.kt", withKotlinRuntime = true) { doc -> + val method = doc.classNamed("BlankLineInsideCodeBlockKt")!!.methods()[0] + val text = method.inlineTags().joinToString(separator = "", transform = Tag::text) + assertEqualsIgnoringSeparators(""" + <p><code><pre> + This is a test + of Dokka's code blocks. + Here is a blank line. + + The previous line was blank. + </pre></code></p> + """.trimIndent(), text) + } + } + private fun verifyJavadoc(name: String, withJdk: Boolean = false, withKotlinRuntime: Boolean = false, diff --git a/core/src/test/kotlin/model/CommentTest.kt b/core/src/test/kotlin/model/CommentTest.kt index 25fea48d..2b2bc87e 100644 --- a/core/src/test/kotlin/model/CommentTest.kt +++ b/core/src/test/kotlin/model/CommentTest.kt @@ -10,14 +10,18 @@ public class CommentTest { verifyModel("testdata/comments/codeBlockComment.kt") { model -> with(model.members.single().members.first()) { assertEqualsIgnoringSeparators("""[code lang=brainfuck] + | |++++++++++[>+++++++>++++++++++>+++>+<<<<-]>++.>+.+++++++..+++.>++.<<+++++++++++++++.>.+++.------.--------.>+.>. + | |[/code] |""".trimMargin(), content.toTestString()) } with(model.members.single().members.last()) { assertEqualsIgnoringSeparators("""[code] + | |a + b - c + | |[/code] |""".trimMargin(), content.toTestString()) |