aboutsummaryrefslogtreecommitdiff
path: root/plugins/base/src/test
diff options
context:
space:
mode:
authorKamil Doległo <9080183+kamildoleglo@users.noreply.github.com>2021-05-17 20:45:00 +0200
committerGitHub <noreply@github.com>2021-05-17 20:45:00 +0200
commitd89be4ba91b8c5cb5e9e34063873004992ee884f (patch)
tree6b4a1ece6ae5f1d0d0675fb7a08801182d89f50e /plugins/base/src/test
parentc94c4baedb6571f27c8a99a419f9bb4c26c4885a (diff)
downloaddokka-d89be4ba91b8c5cb5e9e34063873004992ee884f.tar.gz
dokka-d89be4ba91b8c5cb5e9e34063873004992ee884f.tar.bz2
dokka-d89be4ba91b8c5cb5e9e34063873004992ee884f.zip
Fix preserving spaces in Javadoc comments (#1923)
Fixes #1895
Diffstat (limited to 'plugins/base/src/test')
-rw-r--r--plugins/base/src/test/kotlin/parsers/JavadocParserTest.kt50
1 files changed, 50 insertions, 0 deletions
diff --git a/plugins/base/src/test/kotlin/parsers/JavadocParserTest.kt b/plugins/base/src/test/kotlin/parsers/JavadocParserTest.kt
new file mode 100644
index 00000000..a6a1413c
--- /dev/null
+++ b/plugins/base/src/test/kotlin/parsers/JavadocParserTest.kt
@@ -0,0 +1,50 @@
+package parsers
+
+import org.jetbrains.dokka.base.testApi.testRunner.BaseAbstractTest
+import org.jetbrains.dokka.model.DEnum
+import org.jetbrains.dokka.model.DModule
+import org.junit.jupiter.api.Assertions.assertEquals
+import org.junit.jupiter.api.Test
+import utils.text
+
+class JavadocParserTest : BaseAbstractTest() {
+
+ private fun performJavadocTest(testOperation: (DModule) -> Unit) {
+ val configuration = dokkaConfiguration {
+ sourceSets {
+ sourceSet {
+ sourceRoots = listOf("src/main/java")
+ }
+ }
+ }
+
+ testInline(
+ """
+ |/src/main/java/sample/Date2.java
+ |
+ |package docs
+ |/**
+ | * class level docs
+ | */
+ |public enum AnEnumType {
+ | /**
+ | * content being refreshed, which can be a result of
+ | * invalidation, refresh that may contain content updates, or the initial load.
+ | */
+ | REFRESH
+ |}
+ """.trimIndent(),
+ configuration
+ ) {
+ documentablesMergingStage = testOperation
+ }
+ }
+
+ @Test
+ fun `correctly parsed list`() {
+ performJavadocTest { module ->
+ val docs = (module.packages.single().classlikes.single() as DEnum).entries.single().documentation.values.single().children.single().root.text()
+ assertEquals("content being refreshed, which can be a result of invalidation, refresh that may contain content updates, or the initial load.", docs.trimEnd())
+ }
+ }
+}