aboutsummaryrefslogtreecommitdiff
path: root/plugins/base/src/test
diff options
context:
space:
mode:
authorebraminio <ebraminio@gmail.com>2022-05-16 18:45:40 +0430
committerGitHub <noreply@github.com>2022-05-16 17:15:40 +0300
commit658146291e2bbf3461a2c86f8e8e23cff6b211f6 (patch)
tree053cbef26286d3ac0247eca2e1dd1de97f801c79 /plugins/base/src/test
parentc532003c71cc551ce0df797a8d6207c0edb8eaab (diff)
downloaddokka-658146291e2bbf3461a2c86f8e8e23cff6b211f6.tar.gz
dokka-658146291e2bbf3461a2c86f8e8e23cff6b211f6.tar.bz2
dokka-658146291e2bbf3461a2c86f8e8e23cff6b211f6.zip
Don't expose enum constructor arguments to documentations (#2497)
* Don't expose enum constructor arguments to documentation Enum constructor arguments is mostly internal detail of enums that isn't supposed to be exposed to clients of some library so let's don't put it in the generated documentations result.
Diffstat (limited to 'plugins/base/src/test')
-rw-r--r--plugins/base/src/test/kotlin/enums/EnumsTest.kt51
-rw-r--r--plugins/base/src/test/kotlin/signatures/SignatureTest.kt4
2 files changed, 2 insertions, 53 deletions
diff --git a/plugins/base/src/test/kotlin/enums/EnumsTest.kt b/plugins/base/src/test/kotlin/enums/EnumsTest.kt
index ee4de696..8cb9f654 100644
--- a/plugins/base/src/test/kotlin/enums/EnumsTest.kt
+++ b/plugins/base/src/test/kotlin/enums/EnumsTest.kt
@@ -277,52 +277,6 @@ class EnumsTest : BaseAbstractTest() {
}
@Test
- fun enumWithConstructor() {
- val configuration = dokkaConfiguration {
- sourceSets {
- sourceSet {
- sourceRoots = listOf("src/")
- }
- }
- }
-
- testInline(
- """
- |/src/main/kotlin/basic/TestEnum.kt
- |package testpackage
- |
- |
- |enum class TestEnum(name: String, index: Int, excluded: Boolean) {
- | E1("e1", 1, true),
- | E2("e2", 2, false);
- |}
- """.trimMargin(),
- configuration
- ) {
- documentablesTransformationStage = { m ->
- m.packages.let { p ->
- p.first().classlikes.let { c ->
- val enum = c.first() as DEnum
- val (first, second) = enum.entries.sortedBy { it.name }
-
- assertEquals(1, first.extra.allOfType<ConstructorValues>().size)
- assertEquals(1, second.extra.allOfType<ConstructorValues>().size)
- assertEquals(listOf(StringConstant("e1"), IntegerConstant(1), BooleanConstant(true)), first.extra.allOfType<ConstructorValues>().first().values.values.first())
- assertEquals(listOf(StringConstant("e2"), IntegerConstant(2), BooleanConstant(false)), second.extra.allOfType<ConstructorValues>().first().values.values.first())
- }
- }
- }
- pagesGenerationStage = { module ->
- val entryPage = module.dfs { it.name == "E1" } as ClasslikePageNode
- val signaturePart = (entryPage.content.dfs {
- it is ContentGroup && it.dci.toString() == "[testpackage/TestEnum.E1///PointingToDeclaration/{\"org.jetbrains.dokka.links.EnumEntryDRIExtra\":{\"key\":\"org.jetbrains.dokka.links.EnumEntryDRIExtra\"}}][Symbol]"
- } as ContentGroup)
- assertEquals("(\"e1\", 1, true)", signaturePart.constructorSignature())
- }
- }
- }
-
- @Test
fun enumWithMethods() {
val configuration = dokkaConfiguration {
sourceSets {
@@ -356,8 +310,6 @@ class EnumsTest : BaseAbstractTest() {
val enum = c.first { it is DEnum } as DEnum
val first = enum.entries.first()
- assertEquals(1, first.extra.allOfType<ConstructorValues>().size)
- assertEquals(emptyList<String>(), first.extra.allOfType<ConstructorValues>().first().values.values.first())
assertNotNull(first.functions.find { it.name == "toBeImplemented" })
}
}
@@ -414,7 +366,4 @@ class EnumsTest : BaseAbstractTest() {
}
}
}
-
- private fun ContentGroup.constructorSignature(): String =
- (children.single() as ContentGroup).children.drop(1).joinToString(separator = "") { (it as ContentText).text }
}
diff --git a/plugins/base/src/test/kotlin/signatures/SignatureTest.kt b/plugins/base/src/test/kotlin/signatures/SignatureTest.kt
index 3895eede..2d17b7f8 100644
--- a/plugins/base/src/test/kotlin/signatures/SignatureTest.kt
+++ b/plugins/base/src/test/kotlin/signatures/SignatureTest.kt
@@ -876,7 +876,7 @@ class SignatureTest : BaseAbstractTest() {
}
@Test
- fun `should have no empty parentheses for no-arg enum entry`() {
+ fun `should not expose enum constructor entry arguments`() {
val writerPlugin = TestOutputWriterPlugin()
testInline(
@@ -905,7 +905,7 @@ class SignatureTest : BaseAbstractTest() {
)
enumEntrySignatures[1].match(
- A("WITH_ARG"), "(\"arg\")",
+ A("WITH_ARG"),
ignoreSpanWithTokenStyle = true
)
}