aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--plugins/base/src/test/kotlin/issues/IssuesTest.kt13
-rw-r--r--plugins/base/src/test/kotlin/model/PropertyTest.kt10
-rw-r--r--plugins/base/src/test/kotlin/utils/ModelUtils.kt10
-rw-r--r--testApi/src/main/kotlin/testApi/testRunner/TestRunner.kt17
4 files changed, 40 insertions, 10 deletions
diff --git a/plugins/base/src/test/kotlin/issues/IssuesTest.kt b/plugins/base/src/test/kotlin/issues/IssuesTest.kt
index 41fc2632..f67229b7 100644
--- a/plugins/base/src/test/kotlin/issues/IssuesTest.kt
+++ b/plugins/base/src/test/kotlin/issues/IssuesTest.kt
@@ -32,14 +32,19 @@ class IssuesTest : AbstractModelTest("/src/main/kotlin/issues/Test.kt", "issues"
|
| fun doSomething(): String = "Hello"
|}
- """
+ """,
+ configuration = dokkaConfiguration {
+ passes {
+ pass {
+ sourceRoots = listOf("src/")
+ classpath = listOfNotNull(jvmStdlibPath)
+ }
+ }
+ }
) {
with((this / "issues" / "Test").cast<DClass>()) {
- // passes
(this / "working").cast<DFunction>().type.name equals "String"
(this / "doSomething").cast<DFunction>().type.name equals "String"
-
- // fails
(this / "brokenGenerics").cast<DFunction>().type.name equals "List"
(this / "brokenApply").cast<DFunction>().type.name equals "Test"
(this / "brokenRun").cast<DFunction>().type.name equals "Test"
diff --git a/plugins/base/src/test/kotlin/model/PropertyTest.kt b/plugins/base/src/test/kotlin/model/PropertyTest.kt
index f6f7f3c0..14f7b402 100644
--- a/plugins/base/src/test/kotlin/model/PropertyTest.kt
+++ b/plugins/base/src/test/kotlin/model/PropertyTest.kt
@@ -167,7 +167,15 @@ class PropertyTest : AbstractModelTest("/src/main/kotlin/property/Test.kt", "pro
inlineModelTest(
"""
|@Strictfp var property = "test"
- """
+ """,
+ configuration = dokkaConfiguration {
+ passes {
+ pass {
+ sourceRoots = listOf("src/")
+ classpath = listOfNotNull(jvmStdlibPath)
+ }
+ }
+ }
) {
with((this / "property" / "property").cast<DProperty>()) {
with(extra[Annotations].assertNotNull("Annotations")) {
diff --git a/plugins/base/src/test/kotlin/utils/ModelUtils.kt b/plugins/base/src/test/kotlin/utils/ModelUtils.kt
index 69c4f0d2..f65258b1 100644
--- a/plugins/base/src/test/kotlin/utils/ModelUtils.kt
+++ b/plugins/base/src/test/kotlin/utils/ModelUtils.kt
@@ -1,7 +1,8 @@
package utils
-import org.jetbrains.dokka.plugability.DokkaPlugin
+import org.jetbrains.dokka.DokkaConfigurationImpl
import org.jetbrains.dokka.model.DModule
+import org.jetbrains.dokka.plugability.DokkaPlugin
abstract class AbstractModelTest(val path: String? = null, val pkg: String) : ModelDSL(), AssertDSL {
@@ -12,9 +13,10 @@ abstract class AbstractModelTest(val path: String? = null, val pkg: String) : Mo
prependPackage: Boolean = true,
cleanupOutput: Boolean = true,
pluginsOverrides: List<DokkaPlugin> = emptyList(),
+ configuration: DokkaConfigurationImpl? = null,
block: DModule.() -> Unit
) {
- val configuration = dokkaConfiguration {
+ val testConfiguration = configuration ?: dokkaConfiguration {
passes {
pass {
sourceRoots = listOf("src/")
@@ -27,13 +29,11 @@ abstract class AbstractModelTest(val path: String? = null, val pkg: String) : Mo
testInline(
query = ("$prepend\n$query").trim().trimIndent(),
- configuration = configuration,
+ configuration = testConfiguration,
cleanupOutput = cleanupOutput,
pluginOverrides = pluginsOverrides
) {
documentablesTransformationStage = block
}
}
-
-
}
diff --git a/testApi/src/main/kotlin/testApi/testRunner/TestRunner.kt b/testApi/src/main/kotlin/testApi/testRunner/TestRunner.kt
index d2db90b7..26b9a4b6 100644
--- a/testApi/src/main/kotlin/testApi/testRunner/TestRunner.kt
+++ b/testApi/src/main/kotlin/testApi/testRunner/TestRunner.kt
@@ -1,5 +1,6 @@
package org.jetbrains.dokka.testApi.testRunner
+import com.intellij.openapi.application.PathManager
import org.jetbrains.dokka.*
import org.jetbrains.dokka.model.DModule
import org.jetbrains.dokka.pages.ModulePageNode
@@ -213,6 +214,22 @@ abstract class AbstractCoreTest {
sourceLinks = sourceLinks
)
}
+
+ protected val jvmStdlibPath: String? by lazy {
+ PathManager.getResourceRoot(Strictfp::class.java, "/kotlin/jvm/Strictfp.class")
+ }
+
+ protected val jsStdlibPath: String? by lazy {
+ PathManager.getResourceRoot(Any::class.java, "/kotlin/jquery")
+ }
+
+ protected val commonStdlibPath: String? by lazy {
+ // TODO: feels hacky, find a better way to do it
+ ClassLoader.getSystemResource("kotlin/UInt.kotlin_metadata")
+ ?.file
+ ?.replace("file:", "")
+ ?.replaceAfter(".jar", "")
+ }
}
data class TestMethods(