aboutsummaryrefslogtreecommitdiff
path: root/plugins
diff options
context:
space:
mode:
Diffstat (limited to 'plugins')
-rw-r--r--plugins/base/src/main/kotlin/signatures/KotlinSignatureProvider.kt4
-rw-r--r--plugins/base/src/test/kotlin/enums/EnumsTest.kt1
-rw-r--r--plugins/base/src/test/kotlin/signatures/SignatureTest.kt37
3 files changed, 39 insertions, 3 deletions
diff --git a/plugins/base/src/main/kotlin/signatures/KotlinSignatureProvider.kt b/plugins/base/src/main/kotlin/signatures/KotlinSignatureProvider.kt
index 3c9daa29..612f9ace 100644
--- a/plugins/base/src/main/kotlin/signatures/KotlinSignatureProvider.kt
+++ b/plugins/base/src/main/kotlin/signatures/KotlinSignatureProvider.kt
@@ -80,13 +80,13 @@ class KotlinSignatureProvider(ctcc: CommentsToContentConverter, logger: DokkaLog
link(e.name, e.dri, styles = emptySet())
e.extra[ConstructorValues]?.let { constructorValues ->
constructorValues.values[it]?.let { values ->
- punctuation("(")
list(
elements = values,
+ prefix = "(",
+ suffix = ")",
separator = ", ",
separatorStyles = mainStyles + TokenStyle.Punctuation,
) { highlightValue(it) }
- punctuation(")")
}
}
}
diff --git a/plugins/base/src/test/kotlin/enums/EnumsTest.kt b/plugins/base/src/test/kotlin/enums/EnumsTest.kt
index 778125e2..ee4de696 100644
--- a/plugins/base/src/test/kotlin/enums/EnumsTest.kt
+++ b/plugins/base/src/test/kotlin/enums/EnumsTest.kt
@@ -400,7 +400,6 @@ class EnumsTest : BaseAbstractTest() {
group {
group {
link { +"E1" }
- +"()"
}
}
group {
diff --git a/plugins/base/src/test/kotlin/signatures/SignatureTest.kt b/plugins/base/src/test/kotlin/signatures/SignatureTest.kt
index 6f4de32b..c290846e 100644
--- a/plugins/base/src/test/kotlin/signatures/SignatureTest.kt
+++ b/plugins/base/src/test/kotlin/signatures/SignatureTest.kt
@@ -857,4 +857,41 @@ class SignatureTest : BaseAbstractTest() {
}
}
}
+
+ @Test
+ fun `should have no empty parentheses for no-arg enum entry`() {
+ val writerPlugin = TestOutputWriterPlugin()
+
+ testInline(
+ """
+ |/src/main/kotlin/common/EnumClass.kt
+ |package example
+ |
+ |enum class EnumClass(param: String = "Default") {
+ | EMPTY,
+ | WITH_ARG("arg")
+ |}
+ """.trimMargin(),
+ configuration,
+ pluginOverrides = listOf(writerPlugin)
+ ) {
+ renderingStage = { _, _ ->
+ val enumEntrySignatures = writerPlugin.writer.renderedContent("root/example/-enum-class/index.html")
+ .select("div.table[data-togglable=Entries]")
+ .single()
+ .signature()
+ .select("div.block")
+
+ enumEntrySignatures[0].match(
+ A("EMPTY"),
+ ignoreSpanWithTokenStyle = true
+ )
+
+ enumEntrySignatures[1].match(
+ A("WITH_ARG"), "(\"arg\")",
+ ignoreSpanWithTokenStyle = true
+ )
+ }
+ }
+ }
}