aboutsummaryrefslogtreecommitdiff
path: root/integration-tests
diff options
context:
space:
mode:
Diffstat (limited to 'integration-tests')
-rw-r--r--integration-tests/build.gradle.kts11
-rw-r--r--integration-tests/gradle/projects/it-multiplatform-0/build.gradle.kts13
-rw-r--r--integration-tests/gradle/src/integrationTest/kotlin/org/jetbrains/dokka/it/gradle/Android0GradleIntegrationTest.kt25
3 files changed, 49 insertions, 0 deletions
diff --git a/integration-tests/build.gradle.kts b/integration-tests/build.gradle.kts
index aaa8b153..a41269b9 100644
--- a/integration-tests/build.gradle.kts
+++ b/integration-tests/build.gradle.kts
@@ -1,3 +1,6 @@
+import org.gradle.api.tasks.testing.logging.TestExceptionFormat
+import org.gradle.api.tasks.testing.logging.TestLogEvent
+
subprojects {
sourceSets {
create("integrationTest") {
@@ -38,6 +41,14 @@ subprojects {
?: System.getenv("DOKKA_INTEGRATION_TEST_IS_EXHAUSTIVE")?.toBoolean()
?: false.toString()
)
+
+ testLogging {
+ exceptionFormat = TestExceptionFormat.FULL
+ events(TestLogEvent.SKIPPED, TestLogEvent.FAILED)
+ showExceptions = true
+ showCauses = true
+ showStackTraces = true
+ }
}
tasks.check {
diff --git a/integration-tests/gradle/projects/it-multiplatform-0/build.gradle.kts b/integration-tests/gradle/projects/it-multiplatform-0/build.gradle.kts
index a8d7b837..27283fa2 100644
--- a/integration-tests/gradle/projects/it-multiplatform-0/build.gradle.kts
+++ b/integration-tests/gradle/projects/it-multiplatform-0/build.gradle.kts
@@ -1,3 +1,6 @@
+import org.jetbrains.dokka.gradle.DokkaTask
+import java.net.URL
+
plugins {
kotlin("multiplatform")
id("org.jetbrains.dokka")
@@ -18,3 +21,13 @@ kotlin {
}
}
}
+
+tasks.withType<DokkaTask> {
+ dokkaSourceSets {
+ configureEach {
+ externalDocumentationLink {
+ url = URL("https://kotlin.github.io/kotlinx.coroutines/kotlinx-coroutines-core/")
+ }
+ }
+ }
+}
diff --git a/integration-tests/gradle/src/integrationTest/kotlin/org/jetbrains/dokka/it/gradle/Android0GradleIntegrationTest.kt b/integration-tests/gradle/src/integrationTest/kotlin/org/jetbrains/dokka/it/gradle/Android0GradleIntegrationTest.kt
index 6d71f161..c24ca75b 100644
--- a/integration-tests/gradle/src/integrationTest/kotlin/org/jetbrains/dokka/it/gradle/Android0GradleIntegrationTest.kt
+++ b/integration-tests/gradle/src/integrationTest/kotlin/org/jetbrains/dokka/it/gradle/Android0GradleIntegrationTest.kt
@@ -62,6 +62,13 @@ class Android0GradleIntegrationTest(override val versions: BuildVersions) : Abst
"Expected html files in html output directory"
)
+ htmlOutputDir.allHtmlFiles().forEach { file ->
+ assertContainsNoErrorClass(file)
+ assertNoUnresolvedLinksIgnoringKnown(file)
+ assertNoHrefToMissingLocalFileOrDirectory(file)
+ assertNoEmptyLinks(file)
+ }
+
assertTrue(
htmlOutputDir.allHtmlFiles().any { file ->
"https://developer.android.com/reference/android/content/Context.html" in file.readText()
@@ -81,4 +88,22 @@ class Android0GradleIntegrationTest(override val versions: BuildVersions) : Abst
assertNoHrefToMissingLocalFileOrDirectory(file)
}
}
+
+ // TODO: use [assertNoUnresolvedLinks] instead when https://github.com/Kotlin/dokka/issues/1306 is closed
+ private fun assertNoUnresolvedLinksIgnoringKnown(file: File) {
+ val knownUnresolvedDRIs = setOf(
+ "it.android/IntegrationTestActivity/findViewById/#kotlin.Int/PointingToGenericParameters(0)/",
+ "it.android/IntegrationTestActivity/getExtraData/#java.lang.Class[TypeParam(bounds=[androidx.core.app.ComponentActivity.ExtraData])]/PointingToGenericParameters(0)/",
+ "it.android/IntegrationTestActivity/getSystemService/#java.lang.Class[TypeParam(bounds=[kotlin.Any])]/PointingToGenericParameters(0)/",
+ "it.android/IntegrationTestActivity/requireViewById/#kotlin.Int/PointingToGenericParameters(0)/"
+ )
+ val fileText = file.readText()
+ val regex = Regex("""data-unresolved-link="\[(.+?(?=]"))""")
+ val match = regex.findAll(fileText).map { it.groups[1]!!.value }
+
+ assertTrue(
+ match.filterNot { it in knownUnresolvedDRIs }.toList().isEmpty(),
+ "Unexpected unresolved link in ${file.path}\n" + fileText
+ )
+ }
}