aboutsummaryrefslogtreecommitdiff
path: root/plugins/base/src/test/kotlin/translators
diff options
context:
space:
mode:
authorIgnat Beresnev <ignat.beresnev@jetbrains.com>2023-07-21 13:39:27 +0200
committerGitHub <noreply@github.com>2023-07-21 13:39:27 +0200
commit3f50846197ffce7e5dcc1c80e360ce6d499d67a6 (patch)
tree32ea1154419f175eff64558bfc1cd536e03459e9 /plugins/base/src/test/kotlin/translators
parent19d287f288fdb19b510ab24b9dae80c04db88ede (diff)
downloaddokka-3f50846197ffce7e5dcc1c80e360ce6d499d67a6.tar.gz
dokka-3f50846197ffce7e5dcc1c80e360ce6d499d67a6.tar.bz2
dokka-3f50846197ffce7e5dcc1c80e360ce6d499d67a6.zip
Add tests for parsing data objects (#3076)
Diffstat (limited to 'plugins/base/src/test/kotlin/translators')
-rw-r--r--plugins/base/src/test/kotlin/translators/DefaultDescriptorToDocumentableTranslatorTest.kt28
1 files changed, 26 insertions, 2 deletions
diff --git a/plugins/base/src/test/kotlin/translators/DefaultDescriptorToDocumentableTranslatorTest.kt b/plugins/base/src/test/kotlin/translators/DefaultDescriptorToDocumentableTranslatorTest.kt
index 9a96ad29..3a440af0 100644
--- a/plugins/base/src/test/kotlin/translators/DefaultDescriptorToDocumentableTranslatorTest.kt
+++ b/plugins/base/src/test/kotlin/translators/DefaultDescriptorToDocumentableTranslatorTest.kt
@@ -1,13 +1,13 @@
package translators
import org.jetbrains.dokka.DokkaConfiguration
+import org.jetbrains.dokka.base.signatures.KotlinSignatureUtils.modifiers
import org.jetbrains.dokka.base.testApi.testRunner.BaseAbstractTest
import org.jetbrains.dokka.links.DRI
import org.jetbrains.dokka.links.PointingToDeclaration
import org.jetbrains.dokka.model.*
import org.jetbrains.dokka.model.doc.*
-import org.junit.jupiter.api.Assertions.assertEquals
-import org.junit.jupiter.api.Assertions.assertNull
+import org.junit.jupiter.api.Assertions.*
import org.junit.jupiter.api.Disabled
import org.junit.jupiter.api.Test
import utils.text
@@ -1049,6 +1049,30 @@ val soapXml = node("soap-env:Envelope", soapAttrs,
}
}
}
+
+ @Test
+ fun `should add data modifier to data objects`() {
+ testInline(
+ """
+ |/src/main/kotlin/test/KotlinDataObject.kt
+ |package test
+ |
+ |data object KotlinDataObject {}
+ """.trimIndent(),
+ configuration
+ ) {
+ documentablesMergingStage = { module ->
+ val pckg = module.packages.single { it.name == "test" }
+
+ val dataObject = pckg.classlikes.single { it.name == "KotlinDataObject" }
+ assertInstanceOf(DObject::class.java, dataObject)
+
+ val modifiers = (dataObject as DObject).modifiers().values.flatten()
+ assertEquals(1, modifiers.size)
+ assertEquals(ExtraModifiers.KotlinOnlyModifiers.Data, modifiers[0])
+ }
+ }
+ }
}
private sealed class TestSuite {