diff options
author | Marcin Aman <marcin.aman@gmail.com> | 2021-04-21 10:43:56 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-04-21 10:43:56 +0200 |
commit | 6b3f33f522bd71ce41940f92b13c75bcf556251c (patch) | |
tree | 543e664825077cbda6fcf475778e655063c74bfc /plugins/base/src/test | |
parent | 8ef365f60511ac46e8a8bb13562fab4f1de96f6d (diff) | |
download | dokka-6b3f33f522bd71ce41940f92b13c75bcf556251c.tar.gz dokka-6b3f33f522bd71ce41940f92b13c75bcf556251c.tar.bz2 dokka-6b3f33f522bd71ce41940f92b13c75bcf556251c.zip |
Fix suppressing enum entries by inheritance filter (#1866)
Diffstat (limited to 'plugins/base/src/test')
-rw-r--r-- | plugins/base/src/test/kotlin/transformers/InheritedEntriesDocumentableFilterTransfromerTest.kt | 44 |
1 files changed, 44 insertions, 0 deletions
diff --git a/plugins/base/src/test/kotlin/transformers/InheritedEntriesDocumentableFilterTransfromerTest.kt b/plugins/base/src/test/kotlin/transformers/InheritedEntriesDocumentableFilterTransfromerTest.kt index 9cb956ba..9cde40a5 100644 --- a/plugins/base/src/test/kotlin/transformers/InheritedEntriesDocumentableFilterTransfromerTest.kt +++ b/plugins/base/src/test/kotlin/transformers/InheritedEntriesDocumentableFilterTransfromerTest.kt @@ -1,8 +1,10 @@ package transformers import org.jetbrains.dokka.base.testApi.testRunner.BaseAbstractTest +import org.jetbrains.dokka.model.DEnum import org.junit.jupiter.api.Test import kotlin.test.assertEquals +import kotlin.test.assertTrue class InheritedEntriesDocumentableFilterTransformerTest : BaseAbstractTest() { val suppressingInheritedConfiguration = dokkaConfiguration { @@ -109,4 +111,46 @@ class InheritedEntriesDocumentableFilterTransformerTest : BaseAbstractTest() { } } } + + @Test + fun `should work with enum entries`(){ + testInline( + """ + /src/suppressed/Suppressed.kt + package suppressed + enum class Suppressed { + ENTRY_SUPPRESSED + } + """.trimIndent(), + suppressingInheritedConfiguration + ) { + preMergeDocumentablesTransformationStage = { modules -> + val entry = (modules.flatMap { it.packages }.flatMap { it.classlikes }.first { it.name == "Suppressed" } as DEnum).entries.first() + assertEquals(emptyList(), entry.properties) + assertEquals(emptyList(), entry.functions) + assertEquals(emptyList(), entry.classlikes) + } + } + } + + @Test + fun `should work with enum entries when not suppressing`(){ + testInline( + """ + /src/suppressed/Suppressed.kt + package suppressed + enum class Suppressed { + ENTRY_SUPPRESSED + } + """.trimIndent(), + nonSuppressingInheritedConfiguration + ) { + preMergeDocumentablesTransformationStage = { modules -> + val entry = (modules.flatMap { it.packages }.flatMap { it.classlikes }.first { it.name == "Suppressed" } as DEnum).entries.first() + assertEquals(listOf("name", "ordinal"), entry.properties.map { it.name }) + assertTrue(entry.functions.map { it.name }.containsAll(listOf("compareTo", "equals", "hashCode", "toString"))) + assertEquals(emptyList(), entry.classlikes) + } + } + } }
\ No newline at end of file |