diff options
author | Ignat Beresnev <ignat.beresnev@jetbrains.com> | 2022-07-08 15:14:48 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-07-08 15:14:48 +0200 |
commit | 393491918eb31fd1896c747e636965f917754b1b (patch) | |
tree | e04ceff74b3b6abd3619dd29eabcf0da44f2432f /examples/plugin/hide-internal-api/src/test/kotlin | |
parent | 3ee4fd840a93d976631535450f9b9402b3c89af8 (diff) | |
download | dokka-393491918eb31fd1896c747e636965f917754b1b.tar.gz dokka-393491918eb31fd1896c747e636965f917754b1b.tar.bz2 dokka-393491918eb31fd1896c747e636965f917754b1b.zip |
Revise developer guides documentation (#2523)
Diffstat (limited to 'examples/plugin/hide-internal-api/src/test/kotlin')
-rw-r--r-- | examples/plugin/hide-internal-api/src/test/kotlin/org/example/dokka/plugin/HideInternalApiPluginTest.kt | 44 |
1 files changed, 44 insertions, 0 deletions
diff --git a/examples/plugin/hide-internal-api/src/test/kotlin/org/example/dokka/plugin/HideInternalApiPluginTest.kt b/examples/plugin/hide-internal-api/src/test/kotlin/org/example/dokka/plugin/HideInternalApiPluginTest.kt new file mode 100644 index 00000000..f98208d0 --- /dev/null +++ b/examples/plugin/hide-internal-api/src/test/kotlin/org/example/dokka/plugin/HideInternalApiPluginTest.kt @@ -0,0 +1,44 @@ +package org.example.dokka.plugin + +import org.jetbrains.dokka.base.testApi.testRunner.BaseAbstractTest +import org.junit.Test +import kotlin.test.assertEquals + +class HideInternalApiPluginTest : BaseAbstractTest() { + @Test + fun `should hide annotated functions`() { + val configuration = dokkaConfiguration { + sourceSets { + sourceSet { + sourceRoots = listOf("src/main/kotlin/basic/Test.kt") + } + } + } + val hideInternalPlugin = HideInternalApiPlugin() + + testInline( + """ + |/src/main/kotlin/basic/Test.kt + |package org.jetbrains.dokka.internal.test + | + |annotation class Internal + | + |fun shouldBeVisible() {} + | + |@Internal + |fun shouldBeExcludedFromDocumentation() {} + """.trimMargin(), + configuration = configuration, + pluginOverrides = listOf(hideInternalPlugin) + ) { + preMergeDocumentablesTransformationStage = { modules -> + val testModule = modules.single { it.name == "root" } + val testPackage = testModule.packages.single { it.name == "org.jetbrains.dokka.internal.test" } + + val packageFunctions = testPackage.functions + assertEquals(1, packageFunctions.size) + assertEquals("shouldBeVisible", packageFunctions[0].name) + } + } + } +} |