aboutsummaryrefslogtreecommitdiff
path: root/integration-tests
diff options
context:
space:
mode:
authorsebastian.sellmair <sebastian.sellmair@jetbrains.com>2020-07-10 13:50:01 +0200
committerSebastian Sellmair <34319766+sellmair@users.noreply.github.com>2020-07-13 14:23:08 +0200
commite9b3fead277bdbf0aced2801812cd22c3b8fd625 (patch)
tree0be1b421373c095597599bc93cdbcee8492cb8b5 /integration-tests
parente940349980c40f87309c9ae80593519952d9dd7f (diff)
downloaddokka-e9b3fead277bdbf0aced2801812cd22c3b8fd625.tar.gz
dokka-e9b3fead277bdbf0aced2801812cd22c3b8fd625.tar.bz2
dokka-e9b3fead277bdbf0aced2801812cd22c3b8fd625.zip
Fix first integration tests
Diffstat (limited to 'integration-tests')
-rw-r--r--integration-tests/gradle/src/integrationTest/kotlin/org/jetbrains/dokka/it/gradle/Multimodule0IntegrationTest.kt (renamed from integration-tests/gradle/src/integrationTest/kotlin/org/jetbrains/dokka/it/gradle/MultiModule0IntegrationTest.kt)27
-rw-r--r--integration-tests/gradle/src/integrationTest/kotlin/org/jetbrains/dokka/it/gradle/Multiplatform0GradleIntegrationTest.kt6
-rw-r--r--integration-tests/maven/projects/it-maven/pom.xml2
-rw-r--r--integration-tests/src/main/kotlin/org/jetbrains/dokka/it/AbstractIntegrationTest.kt12
4 files changed, 34 insertions, 13 deletions
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 e4f8b189..75ef547a 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
@@ -5,7 +5,7 @@ import org.junit.runners.Parameterized
import java.io.File
import kotlin.test.*
-class MultiModule0IntegrationTest(override val versions: BuildVersions) : AbstractGradleIntegrationTest() {
+class Multimodule0IntegrationTest(override val versions: BuildVersions) : AbstractGradleIntegrationTest() {
companion object {
@get:JvmStatic
@get:Parameterized.Parameters(name = "{0}")
@@ -30,13 +30,32 @@ class MultiModule0IntegrationTest(override val versions: BuildVersions) : Abstra
assertEquals(TaskOutcome.SUCCESS, assertNotNull(result.task(":moduleA:dokkaKdocMultimodule")).outcome)
- val dokkaOutputDir = File(projectDir, "moduleA/build/dokka/kdocMultimodule")
- assertTrue(dokkaOutputDir.isDirectory, "Missing dokka output directory")
+ val outputDir = File(projectDir, "moduleA/build/dokka/kdocMultimodule")
+ assertTrue(outputDir.isDirectory, "Missing dokka output directory")
- dokkaOutputDir.allHtmlFiles().forEach { file ->
+ assertTrue(
+ outputDir.allHtmlFiles().any(),
+ "Expected at least one html file being generated"
+ )
+
+ outputDir.allHtmlFiles().forEach { file ->
assertContainsNoErrorClass(file)
assertNoUnresolvedLInks(file)
assertNoHrefToMissingLocalFileOrDirectory(file)
}
+
+ val modulesFile = File(outputDir, "-modules.html")
+ assertTrue(modulesFile.isFile, "Missing -modules.html file")
+
+ val modulesFileText = modulesFile.readText()
+ assertTrue(
+ "moduleB" in modulesFileText,
+ "Expected moduleB being mentioned in -modules.html"
+ )
+ assertTrue(
+ "moduleC" in modulesFileText,
+ "Expected moduleC being mentioned in -modules.html"
+ )
+
}
}
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 491f5610..8fa1d3de 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
@@ -27,11 +27,11 @@ class Multiplatform0GradleIntegrationTest(override val versions: BuildVersions)
@Test
fun execute() {
- val result = createGradleRunner("dokka", "--stacktrace").build()
+ val result = createGradleRunner("dokkaKdoc", "--stacktrace").build()
- assertEquals(TaskOutcome.SUCCESS, assertNotNull(result.task(":dokka")).outcome)
+ assertEquals(TaskOutcome.SUCCESS, assertNotNull(result.task(":dokkaKdoc")).outcome)
- val dokkaOutputDir = File(projectDir, "build/dokka")
+ val dokkaOutputDir = File(projectDir, "build/dokka/kdoc")
assertTrue(dokkaOutputDir.isDirectory, "Missing dokka output directory")
dokkaOutputDir.allHtmlFiles().forEach { file ->
diff --git a/integration-tests/maven/projects/it-maven/pom.xml b/integration-tests/maven/projects/it-maven/pom.xml
index 47bd633c..9be87779 100644
--- a/integration-tests/maven/projects/it-maven/pom.xml
+++ b/integration-tests/maven/projects/it-maven/pom.xml
@@ -93,8 +93,6 @@
<!-- Default: ${project.artifactId} -->
<moduleDisplayName>Maven Integration Test Module</moduleDisplayName>
- <!-- See list of possible formats below -->
- <outputFormat>html</outputFormat>
<!-- Default: ${project.basedir}/target/dokka -->
<outputDir>${project.basedir}/output</outputDir>
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 0a83045e..aeebe552 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
@@ -45,13 +45,17 @@ abstract class AbstractIntegrationTest {
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
+ val href = (element.attr("href") ?: return@forEach)
if (href.startsWith("https")) return@forEach
if (href.startsWith("http")) return@forEach
- val targetFile = File(file.parent, href)
+ val hrefWithoutAnchors = if (href.contains("#")) {
+ val hrefSplits = href.split("#")
+ if (hrefSplits.count() != 2) return@forEach
+ hrefSplits.first()
+ } else href
+
+ val targetFile = File(file.parent, hrefWithoutAnchors)
if (targetFile.extension.isNotEmpty() && targetFile.extension !in fileExtensions) return@forEach
if (