diff options
author | Marcin Aman <marcin.aman@gmail.com> | 2021-03-04 15:59:35 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-03-04 15:59:35 +0100 |
commit | 2717e8505a41e188d209b81a3150a16c64ca7239 (patch) | |
tree | 7b527a145b086e92f4fdcc3d4e786f478014f12f /plugins/base/src/test/kotlin/transformers | |
parent | 69dc33255c2cd1cb77b74325c89bc6a3ba34c6fa (diff) | |
download | dokka-2717e8505a41e188d209b81a3150a16c64ca7239.tar.gz dokka-2717e8505a41e188d209b81a3150a16c64ca7239.tar.bz2 dokka-2717e8505a41e188d209b81a3150a16c64ca7239.zip |
Obvious functions should also work for interfaces (#1763)
Diffstat (limited to 'plugins/base/src/test/kotlin/transformers')
-rw-r--r-- | plugins/base/src/test/kotlin/transformers/DivisionSwitchTest.kt | 1 | ||||
-rw-r--r-- | plugins/base/src/test/kotlin/transformers/ObviousFunctionsDocumentableFilterTest.kt | 42 |
2 files changed, 42 insertions, 1 deletions
diff --git a/plugins/base/src/test/kotlin/transformers/DivisionSwitchTest.kt b/plugins/base/src/test/kotlin/transformers/DivisionSwitchTest.kt index 1a2e9fa3..ef36d811 100644 --- a/plugins/base/src/test/kotlin/transformers/DivisionSwitchTest.kt +++ b/plugins/base/src/test/kotlin/transformers/DivisionSwitchTest.kt @@ -46,6 +46,7 @@ class DivisionSwitchTest : BaseAbstractTest() { sourceRoots = listOf("src/") } } + suppressObviousFunctions = false pluginsConfigurations.addIfNotNull( PluginConfigurationImpl( DokkaBase::class.qualifiedName!!, diff --git a/plugins/base/src/test/kotlin/transformers/ObviousFunctionsDocumentableFilterTest.kt b/plugins/base/src/test/kotlin/transformers/ObviousFunctionsDocumentableFilterTest.kt index 01641131..d666b8a7 100644 --- a/plugins/base/src/test/kotlin/transformers/ObviousFunctionsDocumentableFilterTest.kt +++ b/plugins/base/src/test/kotlin/transformers/ObviousFunctionsDocumentableFilterTest.kt @@ -40,6 +40,23 @@ class ObviousFunctionsDocumentableFilterTest : BaseAbstractTest() { } @Test + fun `should suppress toString, equals and hashcode for interface`() { + testInline( + """ + /src/suppressed/Suppressed.kt + package suppressed + interface Suppressed + """.trimIndent(), + suppressingConfiguration + ) { + preMergeDocumentablesTransformationStage = { modules -> + val functions = modules.flatMap { it.packages }.flatMap { it.classlikes }.flatMap { it.functions } + assertEquals(0, functions.size) + } + } + } + + @Test fun `should suppress toString, equals and hashcode in Java`() { testInline( """ @@ -121,6 +138,23 @@ class ObviousFunctionsDocumentableFilterTest : BaseAbstractTest() { } @Test + fun `not should suppress toString, equals and hashcode for interface if custom config is provided`() { + testInline( + """ + /src/suppressed/Suppressed.kt + package suppressed + interface Suppressed + """.trimIndent(), + nonSuppressingConfiguration + ) { + preMergeDocumentablesTransformationStage = { modules -> + val functions = modules.flatMap { it.packages }.flatMap { it.classlikes }.flatMap { it.functions } + assertEquals(listOf("equals", "hashCode", "toString").sorted(), functions.map { it.name }.sorted()) + } + } + } + + @Test fun `should not suppress toString, equals and hashcode if custom config is provided in Java`() { testInline( """ @@ -136,7 +170,13 @@ class ObviousFunctionsDocumentableFilterTest : BaseAbstractTest() { //I would normally just assert names but this would make it JDK dependent, so this is better assertEquals( 5, - setOf("equals", "hashCode", "toString", "notify", "notifyAll").intersect(functions.map { it.name }).size + setOf( + "equals", + "hashCode", + "toString", + "notify", + "notifyAll" + ).intersect(functions.map { it.name }).size ) } } |