diff options
author | vmishenev <vad-mishenev@yandex.ru> | 2021-08-11 17:26:43 +0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-08-11 16:26:43 +0200 |
commit | 42c0320e0c5f2d79a5438558bb87d4668aa4c3cc (patch) | |
tree | c4894da9c4dd438bd39351858069f77d90ea552f /plugins/base/src/test | |
parent | d197f0544b4cd1ade870ebde0d6a6a43a94daf9a (diff) | |
download | dokka-42c0320e0c5f2d79a5438558bb87d4668aa4c3cc.tar.gz dokka-42c0320e0c5f2d79a5438558bb87d4668aa4c3cc.tar.bz2 dokka-42c0320e0c5f2d79a5438558bb87d4668aa4c3cc.zip |
Handling `@code` tag (#2059)
Diffstat (limited to 'plugins/base/src/test')
-rw-r--r-- | plugins/base/src/test/kotlin/parsers/JavadocParserTest.kt | 62 |
1 files changed, 61 insertions, 1 deletions
diff --git a/plugins/base/src/test/kotlin/parsers/JavadocParserTest.kt b/plugins/base/src/test/kotlin/parsers/JavadocParserTest.kt index a6a1413c..d6fffee3 100644 --- a/plugins/base/src/test/kotlin/parsers/JavadocParserTest.kt +++ b/plugins/base/src/test/kotlin/parsers/JavadocParserTest.kt @@ -1,14 +1,27 @@ package parsers +import com.jetbrains.rd.util.first import org.jetbrains.dokka.base.testApi.testRunner.BaseAbstractTest import org.jetbrains.dokka.model.DEnum import org.jetbrains.dokka.model.DModule +import org.jetbrains.dokka.model.doc.CodeBlock +import org.jetbrains.dokka.model.doc.CodeInline +import org.jetbrains.dokka.model.doc.Text import org.junit.jupiter.api.Assertions.assertEquals import org.junit.jupiter.api.Test -import utils.text +import utils.* class JavadocParserTest : BaseAbstractTest() { + private val configuration = dokkaConfiguration { + sourceSets { + sourceSet { + sourceRoots = listOf("src/") + analysisPlatform = "jvm" + } + } + } + private fun performJavadocTest(testOperation: (DModule) -> Unit) { val configuration = dokkaConfiguration { sourceSets { @@ -47,4 +60,51 @@ class JavadocParserTest : BaseAbstractTest() { assertEquals("content being refreshed, which can be a result of invalidation, refresh that may contain content updates, or the initial load.", docs.trimEnd()) } } + + @Test + fun `code tag`() { + val source = """ + |/src/main/kotlin/test/Test.java + |package example + | + | /** + | * Identifies calls to {@code assertThat}. + | * + | * {@code + | * Set<String> s; + | * System.out.println("s1 = " + s); + | * } + | * <pre>{@code + | * Set<String> s2; + | * System.out + | * .println("s2 = " + s2); + | * }</pre> + | * + | */ + | public class Test {} + """.trimIndent() + testInline( + source, + configuration, + ) { + documentablesCreationStage = { modules -> + val docs = modules.first().packages.first().classlikes.single().documentation.first().value + val root = docs.children.first().root + + kotlin.test.assertEquals( + listOf( + Text(body = "Identifies calls to "), + CodeInline(children = listOf(Text(body = "assertThat"))), + Text(body = ". "), + CodeInline(children = listOf(Text(body = "\nSet<String> s;\nSystem.out.println(\"s1 = \" + s);\n"))) + ), + root.children[0].children + ) + kotlin.test.assertEquals( + CodeBlock(children = listOf(Text(body = "\nSet<String> s2;\nSystem.out\n .println(\"s2 = \" + s2);\n"))), + root.children[1] + ) + } + } + } } |