diff options
author | Ignat Beresnev <ignat.beresnev@jetbrains.com> | 2022-04-27 16:13:13 +0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-04-27 16:13:13 +0300 |
commit | 2aabdea6113da6cb50edf18afb146b7120071e68 (patch) | |
tree | e4cf90a1d9d41dec29d5950cee4df3f960c0d3cc /plugins/base/src/test/kotlin | |
parent | a43f710c7802f418f8ca3b41ef8ac726c75987aa (diff) | |
download | dokka-2aabdea6113da6cb50edf18afb146b7120071e68.tar.gz dokka-2aabdea6113da6cb50edf18afb146b7120071e68.tar.bz2 dokka-2aabdea6113da6cb50edf18afb146b7120071e68.zip |
Fix empty parentheses for no-arg enum entry (#2470)
* Fix empty parentheses for no-arg enum entry
Fixes #2355
* Move parentheses punctuation inside `list` call
* Revert formatting
* Correct expected ordering of enum entries in tests
Diffstat (limited to 'plugins/base/src/test/kotlin')
-rw-r--r-- | plugins/base/src/test/kotlin/enums/EnumsTest.kt | 1 | ||||
-rw-r--r-- | plugins/base/src/test/kotlin/signatures/SignatureTest.kt | 37 |
2 files changed, 37 insertions, 1 deletions
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 + ) + } + } + } } |