aboutsummaryrefslogtreecommitdiff
path: root/plugins/base/src/test/kotlin
diff options
context:
space:
mode:
authorAndrzej Ratajczak <andrzej.ratajczak98@gmail.com>2020-09-30 14:57:10 +0200
committerPaweł Marks <Kordyjan@users.noreply.github.com>2020-10-02 14:12:05 +0200
commit249556460973007de3d436ddda1df7d100aefab0 (patch)
tree5b5e05f761927f69488c80cf195643cbdae09c33 /plugins/base/src/test/kotlin
parent8de5296b18083361055d11acf6d522c1eef821a4 (diff)
downloaddokka-249556460973007de3d436ddda1df7d100aefab0.tar.gz
dokka-249556460973007de3d436ddda1df7d100aefab0.tar.bz2
dokka-249556460973007de3d436ddda1df7d100aefab0.zip
Fix typealiases filtering when private
Diffstat (limited to 'plugins/base/src/test/kotlin')
-rw-r--r--plugins/base/src/test/kotlin/filter/VisibilityFilterTest.kt52
1 files changed, 44 insertions, 8 deletions
diff --git a/plugins/base/src/test/kotlin/filter/VisibilityFilterTest.kt b/plugins/base/src/test/kotlin/filter/VisibilityFilterTest.kt
index 192de449..f818cae8 100644
--- a/plugins/base/src/test/kotlin/filter/VisibilityFilterTest.kt
+++ b/plugins/base/src/test/kotlin/filter/VisibilityFilterTest.kt
@@ -4,8 +4,10 @@ import org.jetbrains.dokka.PackageOptionsImpl
import org.jetbrains.dokka.testApi.testRunner.AbstractCoreTest
import org.junit.jupiter.api.Assertions
import org.junit.jupiter.api.Test
+import kotlin.test.assertEquals
class VisibilityFilterTest : AbstractCoreTest() {
+
@Test
fun `public function with false global includeNonPublic`() {
val configuration = dokkaConfiguration {
@@ -36,6 +38,7 @@ class VisibilityFilterTest : AbstractCoreTest() {
}
}
}
+
@Test
fun `private function with false global includeNonPublic`() {
val configuration = dokkaConfiguration {
@@ -66,6 +69,7 @@ class VisibilityFilterTest : AbstractCoreTest() {
}
}
}
+
@Test
fun `private function with true global includeNonPublic`() {
val configuration = dokkaConfiguration {
@@ -96,6 +100,7 @@ class VisibilityFilterTest : AbstractCoreTest() {
}
}
}
+
@Test
fun `private function with false global true package includeNonPublic`() {
val configuration = dokkaConfiguration {
@@ -104,11 +109,13 @@ class VisibilityFilterTest : AbstractCoreTest() {
sourceRoots = listOf("src/main/kotlin/basic/Test.kt")
includeNonPublic = false
perPackageOptions = mutableListOf(
- PackageOptionsImpl("example",
+ PackageOptionsImpl(
+ "example",
true,
false,
false,
- false)
+ false
+ )
)
}
}
@@ -133,6 +140,7 @@ class VisibilityFilterTest : AbstractCoreTest() {
}
}
}
+
@Test
fun `private function with true global false package includeNonPublic`() {
val configuration = dokkaConfiguration {
@@ -141,11 +149,13 @@ class VisibilityFilterTest : AbstractCoreTest() {
sourceRoots = listOf("src/main/kotlin/basic/Test.kt")
includeNonPublic = true
perPackageOptions = mutableListOf(
- PackageOptionsImpl("example",
+ PackageOptionsImpl(
+ "example",
false,
false,
false,
- false)
+ false
+ )
)
}
}
@@ -164,10 +174,36 @@ class VisibilityFilterTest : AbstractCoreTest() {
configuration
) {
documentablesFirstTransformationStep = {
- Assertions.assertTrue(
- it.component2().packages.first().functions.size == 0
- )
- }
+ Assertions.assertTrue(
+ it.component2().packages.first().functions.size == 0
+ )
+ }
+ }
+ }
+
+ @Test
+ fun `private typealias should be skipped`() {
+ val configuration = dokkaConfiguration {
+ sourceSets {
+ sourceSet {
+ includeNonPublic = false
+ sourceRoots = listOf("src/main/kotlin/basic/Test.kt")
+ }
+ }
+ }
+
+ testInline(
+ """
+ |/src/main/kotlin/basic/Test.kt
+ |package example
+ |
+ |private typealias ABC = Int
+ """.trimMargin(),
+ configuration
+ ) {
+ documentablesFirstTransformationStep = {
+ assertEquals(0, it.component2().packages.first().typealiases.size)
+ }
}
}
}