aboutsummaryrefslogtreecommitdiff
path: root/plugins/base/src/test/kotlin/utils
diff options
context:
space:
mode:
authorSzymon Świstun <sswistun@virtuslab.com>2020-03-10 18:39:19 +0100
committerPaweł Marks <Kordyjan@users.noreply.github.com>2020-03-16 15:31:20 +0100
commitfb27b386af878a7cd942e97701b66a0d67f7778c (patch)
tree83957e5bbbc9d1b68ff4430546b6b5e6d0b7f094 /plugins/base/src/test/kotlin/utils
parent996feefe717ac623daabaadda71b5b9d2bbe1cf1 (diff)
downloaddokka-fb27b386af878a7cd942e97701b66a0d67f7778c.tar.gz
dokka-fb27b386af878a7cd942e97701b66a0d67f7778c.tar.bz2
dokka-fb27b386af878a7cd942e97701b66a0d67f7778c.zip
Extract inheritance map
Diffstat (limited to 'plugins/base/src/test/kotlin/utils')
-rw-r--r--plugins/base/src/test/kotlin/utils/ModelUtils.kt12
-rw-r--r--plugins/base/src/test/kotlin/utils/TestUtils.kt14
2 files changed, 21 insertions, 5 deletions
diff --git a/plugins/base/src/test/kotlin/utils/ModelUtils.kt b/plugins/base/src/test/kotlin/utils/ModelUtils.kt
index 1e6f64c6..69c4f0d2 100644
--- a/plugins/base/src/test/kotlin/utils/ModelUtils.kt
+++ b/plugins/base/src/test/kotlin/utils/ModelUtils.kt
@@ -1,5 +1,6 @@
package utils
+import org.jetbrains.dokka.plugability.DokkaPlugin
import org.jetbrains.dokka.model.DModule
abstract class AbstractModelTest(val path: String? = null, val pkg: String) : ModelDSL(), AssertDSL {
@@ -9,6 +10,8 @@ abstract class AbstractModelTest(val path: String? = null, val pkg: String) : Mo
platform: String = "jvm",
targetList: List<String> = listOf("jvm"),
prependPackage: Boolean = true,
+ cleanupOutput: Boolean = true,
+ pluginsOverrides: List<DokkaPlugin> = emptyList(),
block: DModule.() -> Unit
) {
val configuration = dokkaConfiguration {
@@ -20,9 +23,14 @@ abstract class AbstractModelTest(val path: String? = null, val pkg: String) : Mo
}
}
}
- val prepend = path.let { p -> p?.let { "|$it\n" } ?: "" } + if(prependPackage) "|package $pkg" else ""
+ val prepend = path.let { p -> p?.let { "|$it\n" } ?: "" } + if (prependPackage) "|package $pkg" else ""
- testInline(("$prepend\n$query").trim().trimIndent(), configuration) {
+ testInline(
+ query = ("$prepend\n$query").trim().trimIndent(),
+ configuration = configuration,
+ cleanupOutput = cleanupOutput,
+ pluginOverrides = pluginsOverrides
+ ) {
documentablesTransformationStage = block
}
}
diff --git a/plugins/base/src/test/kotlin/utils/TestUtils.kt b/plugins/base/src/test/kotlin/utils/TestUtils.kt
index bf86c1b1..68ab7120 100644
--- a/plugins/base/src/test/kotlin/utils/TestUtils.kt
+++ b/plugins/base/src/test/kotlin/utils/TestUtils.kt
@@ -1,9 +1,9 @@
package utils
-import org.jetbrains.dokka.model.DClass
-import org.jetbrains.dokka.model.Documentable
+import org.jetbrains.dokka.model.*
import org.jetbrains.dokka.model.doc.*
import org.jetbrains.dokka.testApi.testRunner.AbstractCoreTest
+import kotlin.collections.orEmpty
@DslMarker
annotation class TestDSL
@@ -61,4 +61,12 @@ fun <T> T?.assertNotNull(name: String = ""): T = this ?: throw AssertionError("$
fun <T : Documentable> T?.docs() = this?.documentation.orEmpty().values.flatMap { it.children }
val DClass.supers
- get() = supertypes.flatMap{it.component2()} \ No newline at end of file
+ get() = supertypes.flatMap { it.component2() }
+
+val Bound.name: String?
+ get() = when (this) {
+ is Nullable -> inner.name
+ is OtherParameter -> name
+ is PrimitiveJavaType -> name
+ is TypeConstructor -> dri.classNames
+ } \ No newline at end of file