aboutsummaryrefslogtreecommitdiff
path: root/integration-tests
diff options
context:
space:
mode:
Diffstat (limited to 'integration-tests')
-rw-r--r--integration-tests/build.gradle.kts4
-rw-r--r--integration-tests/gradle/src/integrationTest/kotlin/org/jetbrains/dokka/it/gradle/Android0GradleIntegrationTest.kt1
-rw-r--r--integration-tests/gradle/src/integrationTest/kotlin/org/jetbrains/dokka/it/gradle/BasicGradleIntegrationTest.kt2
-rw-r--r--integration-tests/gradle/src/integrationTest/kotlin/org/jetbrains/dokka/it/gradle/MultiModule0IntegrationTest.kt1
-rw-r--r--integration-tests/gradle/src/integrationTest/kotlin/org/jetbrains/dokka/it/gradle/Multiplatform0GradleIntegrationTest.kt2
-rw-r--r--integration-tests/src/main/kotlin/org/jetbrains/dokka/it/AbstractIntegrationTest.kt28
6 files changed, 35 insertions, 3 deletions
diff --git a/integration-tests/build.gradle.kts b/integration-tests/build.gradle.kts
index 8458f1fe..fb987c36 100644
--- a/integration-tests/build.gradle.kts
+++ b/integration-tests/build.gradle.kts
@@ -38,4 +38,6 @@ dependencies {
implementation(kotlin("stdlib"))
implementation(kotlin("test-junit"))
val coroutines_version: String by project
- implementation("org.jetbrains.kotlinx:kotlinx-coroutines-core:$coroutines_version")}
+ implementation("org.jetbrains.kotlinx:kotlinx-coroutines-core:$coroutines_version")
+ implementation("org.jsoup:jsoup:1.12.1")
+}
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 0a29555f..2b8ba45d 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
@@ -57,6 +57,7 @@ class Android0GradleIntegrationTest(override val versions: BuildVersions) : Abst
projectDir.allHtmlFiles().forEach { file ->
assertContainsNoErrorClass(file)
assertNoUnresolvedLInks(file)
+ assertNoHrefToMissingLocalFileOrDirectory(file)
}
assertTrue(
diff --git a/integration-tests/gradle/src/integrationTest/kotlin/org/jetbrains/dokka/it/gradle/BasicGradleIntegrationTest.kt b/integration-tests/gradle/src/integrationTest/kotlin/org/jetbrains/dokka/it/gradle/BasicGradleIntegrationTest.kt
index a15dc60a..87460080 100644
--- a/integration-tests/gradle/src/integrationTest/kotlin/org/jetbrains/dokka/it/gradle/BasicGradleIntegrationTest.kt
+++ b/integration-tests/gradle/src/integrationTest/kotlin/org/jetbrains/dokka/it/gradle/BasicGradleIntegrationTest.kt
@@ -1,7 +1,6 @@
package org.jetbrains.dokka.it.gradle
import org.gradle.testkit.runner.TaskOutcome
-import org.junit.runners.Parameterized
import org.junit.runners.Parameterized.Parameters
import java.io.File
import kotlin.test.*
@@ -76,6 +75,7 @@ class BasicGradleIntegrationTest(override val versions: BuildVersions) : Abstrac
allHtmlFiles().forEach { file ->
assertContainsNoErrorClass(file)
assertNoUnresolvedLInks(file)
+ assertNoHrefToMissingLocalFileOrDirectory(file)
}
}
diff --git a/integration-tests/gradle/src/integrationTest/kotlin/org/jetbrains/dokka/it/gradle/MultiModule0IntegrationTest.kt b/integration-tests/gradle/src/integrationTest/kotlin/org/jetbrains/dokka/it/gradle/MultiModule0IntegrationTest.kt
index 36362552..e4f8b189 100644
--- a/integration-tests/gradle/src/integrationTest/kotlin/org/jetbrains/dokka/it/gradle/MultiModule0IntegrationTest.kt
+++ b/integration-tests/gradle/src/integrationTest/kotlin/org/jetbrains/dokka/it/gradle/MultiModule0IntegrationTest.kt
@@ -36,6 +36,7 @@ class MultiModule0IntegrationTest(override val versions: BuildVersions) : Abstra
dokkaOutputDir.allHtmlFiles().forEach { file ->
assertContainsNoErrorClass(file)
assertNoUnresolvedLInks(file)
+ assertNoHrefToMissingLocalFileOrDirectory(file)
}
}
}
diff --git a/integration-tests/gradle/src/integrationTest/kotlin/org/jetbrains/dokka/it/gradle/Multiplatform0GradleIntegrationTest.kt b/integration-tests/gradle/src/integrationTest/kotlin/org/jetbrains/dokka/it/gradle/Multiplatform0GradleIntegrationTest.kt
index b54eecb1..491f5610 100644
--- a/integration-tests/gradle/src/integrationTest/kotlin/org/jetbrains/dokka/it/gradle/Multiplatform0GradleIntegrationTest.kt
+++ b/integration-tests/gradle/src/integrationTest/kotlin/org/jetbrains/dokka/it/gradle/Multiplatform0GradleIntegrationTest.kt
@@ -1,7 +1,6 @@
package org.jetbrains.dokka.it.gradle
import org.gradle.testkit.runner.TaskOutcome
-import org.gradle.util.GradleVersion
import org.junit.runners.Parameterized
import java.io.File
import kotlin.test.*
@@ -38,6 +37,7 @@ class Multiplatform0GradleIntegrationTest(override val versions: BuildVersions)
dokkaOutputDir.allHtmlFiles().forEach { file ->
assertContainsNoErrorClass(file)
assertNoUnresolvedLInks(file)
+ assertNoHrefToMissingLocalFileOrDirectory(file)
}
}
}
diff --git a/integration-tests/src/main/kotlin/org/jetbrains/dokka/it/AbstractIntegrationTest.kt b/integration-tests/src/main/kotlin/org/jetbrains/dokka/it/AbstractIntegrationTest.kt
index 4af523a2..0a83045e 100644
--- a/integration-tests/src/main/kotlin/org/jetbrains/dokka/it/AbstractIntegrationTest.kt
+++ b/integration-tests/src/main/kotlin/org/jetbrains/dokka/it/AbstractIntegrationTest.kt
@@ -1,9 +1,11 @@
package org.jetbrains.dokka.it
+import org.jsoup.Jsoup
import org.junit.Rule
import org.junit.rules.TemporaryFolder
import java.io.File
import kotlin.test.assertFalse
+import kotlin.test.assertTrue
abstract class AbstractIntegrationTest {
@@ -36,4 +38,30 @@ abstract class AbstractIntegrationTest {
"Unexpected unresolved link in ${file.path}\n" + fileText
)
}
+
+ protected fun assertNoHrefToMissingLocalFileOrDirectory(
+ file: File, fileExtensions: Set<String> = setOf("html")
+ ) {
+ val fileText = file.readText()
+ val html = Jsoup.parse(fileText)
+ html.allElements.toList().forEach { element ->
+ val href = element.attr("href") ?: return@forEach
+
+ if (href.startsWith("#")) return@forEach
+ if (href.startsWith("https")) return@forEach
+ if (href.startsWith("http")) return@forEach
+
+ val targetFile = File(file.parent, href)
+ if (targetFile.extension.isNotEmpty() && targetFile.extension !in fileExtensions) return@forEach
+
+ if (
+ targetFile.extension.isEmpty() || targetFile.extension == "html" && !href.startsWith("#")) {
+ assertTrue(
+ targetFile.exists(),
+ "${file.relativeTo(projectDir).path}: href=\"$href\"\n" +
+ "file does not exist: ${targetFile.relativeTo(projectDir).path}"
+ )
+ }
+ }
+ }
}