From cacf1e0c6cda4e42fe6581946cad53a377c71ec7 Mon Sep 17 00:00:00 2001 From: Szymon Świstun Date: Wed, 26 Feb 2020 11:52:03 +0100 Subject: Port some of the core tests from the previous model --- plugins/base/src/test/kotlin/utils/ModelUtils.kt | 33 ++++++++++++++++++++++++ 1 file changed, 33 insertions(+) create mode 100644 plugins/base/src/test/kotlin/utils/ModelUtils.kt (limited to 'plugins/base/src/test/kotlin/utils/ModelUtils.kt') diff --git a/plugins/base/src/test/kotlin/utils/ModelUtils.kt b/plugins/base/src/test/kotlin/utils/ModelUtils.kt new file mode 100644 index 00000000..6893c65f --- /dev/null +++ b/plugins/base/src/test/kotlin/utils/ModelUtils.kt @@ -0,0 +1,33 @@ +package utils + +import org.jetbrains.dokka.model.Module +import org.jetbrains.dokka.model.doc.DocumentationNode +import testApi.testRunner.AbstractCoreTest + +abstract class AbstractModelTest(val path: String? = null, val pkg: String) : ModelDSL(), AssertDSL { + + fun inlineModelTest( + query: String, + platform: String = "jvm", + targetList: List = listOf("jvm"), + prependPackage: Boolean = true, + block: Module.() -> Unit + ) { + val configuration = dokkaConfiguration { + passes { + pass { + sourceRoots = listOf("src/") + analysisPlatform = platform + targets = targetList + } + } + } + val prepend = path.let { p -> p?.let { "|$it\n" } ?: "" } + if(prependPackage) "|package $pkg" else "" + + testInline(("$prepend\n$query").trim().trimIndent(), configuration) { + documentablesTransformationStage = block + } + } + + +} -- cgit