From 5c98d42ec08ca1413f920e4f5dde28d330e8837a Mon Sep 17 00:00:00 2001 From: Vadim Mishenev Date: Thu, 23 Dec 2021 12:05:59 +0300 Subject: Allow filtering of property setter (#2220) * Allow filtering of property setter * Improve code style --- .../src/test/kotlin/filter/VisibilityFilterTest.kt | 31 ++++++++++++++++++++++ .../kotlin/transformers/SuppressTagFilterTest.kt | 20 ++++++++++++++ 2 files changed, 51 insertions(+) (limited to 'plugins/base/src/test/kotlin') diff --git a/plugins/base/src/test/kotlin/filter/VisibilityFilterTest.kt b/plugins/base/src/test/kotlin/filter/VisibilityFilterTest.kt index ffefaaea..1bb2d5d0 100644 --- a/plugins/base/src/test/kotlin/filter/VisibilityFilterTest.kt +++ b/plugins/base/src/test/kotlin/filter/VisibilityFilterTest.kt @@ -104,6 +104,37 @@ class VisibilityFilterTest : BaseAbstractTest() { } } + @Test + fun `private setter with false global includeNonPublic`() { + val configuration = dokkaConfiguration { + sourceSets { + sourceSet { + includeNonPublic = false + sourceRoots = listOf("src/main/kotlin/basic/Test.kt") + } + } + } + + testInline( + """ + |/src/main/kotlin/basic/Test.kt + |package example + | + |var property: Int = 0 + |private set + | + | + """.trimMargin(), + configuration + ) { + preMergeDocumentablesTransformationStage = { + Assertions.assertNull( + it.first().packages.first().properties.first().setter + ) + } + } + } + @Test fun `private function with false global true package includeNonPublic`() { val configuration = dokkaConfiguration { diff --git a/plugins/base/src/test/kotlin/transformers/SuppressTagFilterTest.kt b/plugins/base/src/test/kotlin/transformers/SuppressTagFilterTest.kt index fb8f520e..de1ee46c 100644 --- a/plugins/base/src/test/kotlin/transformers/SuppressTagFilterTest.kt +++ b/plugins/base/src/test/kotlin/transformers/SuppressTagFilterTest.kt @@ -88,6 +88,26 @@ class SuppressTagFilterTest : BaseAbstractTest() { } } + @Test + fun `should filter setter`() { + testInline( + """ + |/src/suppressed/Suppressed.kt + |var property: Int + |/** @suppress */ + |private set + """.trimIndent(), configuration + ) { + preMergeDocumentablesTransformationStage = { modules -> + val prop = modules.flatMap { it.packages }.flatMap { it.properties } + .find { it.name == "property" } + assertNotNull(prop) + assertNotNull(prop.getter) + assertNull(prop.setter) + } + } + } + @Test fun `should filter top level type aliases`() { testInline( -- cgit