diff options
author | Ignat Beresnev <ignat.beresnev@jetbrains.com> | 2022-05-06 15:35:27 +0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-05-06 15:35:27 +0300 |
commit | 12bf21bc0814b0b85655e957ce9f3a99ef389785 (patch) | |
tree | 32d80c870acafdca19f3fa8ab58ce8506ab304d3 /plugins/base/src/test/kotlin | |
parent | 88d36234b710f2ef50db9d874e25fd2378f430ac (diff) | |
download | dokka-12bf21bc0814b0b85655e957ce9f3a99ef389785.tar.gz dokka-12bf21bc0814b0b85655e957ce9f3a99ef389785.tar.bz2 dokka-12bf21bc0814b0b85655e957ce9f3a99ef389785.zip |
Skip `@Deprecated` documentables with HIDDEN level (#2486)
Diffstat (limited to 'plugins/base/src/test/kotlin')
-rw-r--r-- | plugins/base/src/test/kotlin/filter/DeprecationFilterTest.kt | 80 |
1 files changed, 80 insertions, 0 deletions
diff --git a/plugins/base/src/test/kotlin/filter/DeprecationFilterTest.kt b/plugins/base/src/test/kotlin/filter/DeprecationFilterTest.kt index 295a969b..44caecaa 100644 --- a/plugins/base/src/test/kotlin/filter/DeprecationFilterTest.kt +++ b/plugins/base/src/test/kotlin/filter/DeprecationFilterTest.kt @@ -7,6 +7,47 @@ import org.junit.jupiter.api.Assertions import org.junit.jupiter.api.Test class DeprecationFilterTest : BaseAbstractTest() { + + @Test + fun `should skip hidden deprecated level regardless of skipDeprecated`() { + val configuration = dokkaConfiguration { + sourceSets { + sourceSet { + sourceRoots = listOf("src/main/kotlin/basic/Test.kt") + skipDeprecated = false + perPackageOptions = mutableListOf( + PackageOptionsImpl( + "example.*", + true, + false, + false, + false, + DokkaDefaults.documentedVisibilities + ) + ) + } + } + } + + testInline( + """ + |/src/main/kotlin/basic/Test.kt + |package example + | + |@Deprecated("dep", level = DeprecationLevel.HIDDEN) + |fun testFunction() { } + | + """.trimMargin(), + configuration + ) { + preMergeDocumentablesTransformationStage = { + Assertions.assertTrue( + it.first().packages.first().functions.isEmpty() + ) + } + } + } + @Test fun `function with false global skipDeprecated`() { val configuration = dokkaConfiguration { @@ -37,6 +78,7 @@ class DeprecationFilterTest : BaseAbstractTest() { } } } + @Test fun `deprecated function with false global skipDeprecated`() { val configuration = dokkaConfiguration { @@ -67,6 +109,7 @@ class DeprecationFilterTest : BaseAbstractTest() { } } } + @Test fun `deprecated function with true global skipDeprecated`() { val configuration = dokkaConfiguration { @@ -97,6 +140,42 @@ class DeprecationFilterTest : BaseAbstractTest() { } } } + + @Test + fun `should skip deprecated companion object`() { + val configuration = dokkaConfiguration { + sourceSets { + sourceSet { + sourceRoots = listOf("src/main/kotlin/basic/Test.kt") + skipDeprecated = true + } + } + } + + testInline( + """ + |/src/main/kotlin/basic/Test.kt + |package example + | + |class Test { + | @Deprecated("dep") + | companion object { + | fun method() {} + | } + |} + | + | + """.trimMargin(), + configuration + ) { + preMergeDocumentablesTransformationStage = { + Assertions.assertTrue( + it.first().packages.first().classlikes.first().classlikes.isEmpty() + ) + } + } + } + @Test fun `deprecated function with false global true package skipDeprecated`() { val configuration = dokkaConfiguration { @@ -137,6 +216,7 @@ class DeprecationFilterTest : BaseAbstractTest() { } } } + @Test fun `deprecated function with true global false package skipDeprecated`() { val configuration = dokkaConfiguration { |