From e9b3fead277bdbf0aced2801812cd22c3b8fd625 Mon Sep 17 00:00:00 2001 From: "sebastian.sellmair" Date: Fri, 10 Jul 2020 13:50:01 +0200 Subject: Fix first integration tests --- .../dokka/it/gradle/MultiModule0IntegrationTest.kt | 42 --------------- .../dokka/it/gradle/Multimodule0IntegrationTest.kt | 61 ++++++++++++++++++++++ .../gradle/Multiplatform0GradleIntegrationTest.kt | 6 +-- 3 files changed, 64 insertions(+), 45 deletions(-) delete mode 100644 integration-tests/gradle/src/integrationTest/kotlin/org/jetbrains/dokka/it/gradle/MultiModule0IntegrationTest.kt create mode 100644 integration-tests/gradle/src/integrationTest/kotlin/org/jetbrains/dokka/it/gradle/Multimodule0IntegrationTest.kt (limited to 'integration-tests/gradle/src/integrationTest/kotlin') 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 deleted file mode 100644 index e4f8b189..00000000 --- a/integration-tests/gradle/src/integrationTest/kotlin/org/jetbrains/dokka/it/gradle/MultiModule0IntegrationTest.kt +++ /dev/null @@ -1,42 +0,0 @@ -package org.jetbrains.dokka.it.gradle - -import org.gradle.testkit.runner.TaskOutcome -import org.junit.runners.Parameterized -import java.io.File -import kotlin.test.* - -class MultiModule0IntegrationTest(override val versions: BuildVersions) : AbstractGradleIntegrationTest() { - companion object { - @get:JvmStatic - @get:Parameterized.Parameters(name = "{0}") - val versions = BuildVersions.permutations( - gradleVersions = listOf("6.5.1", "6.1.1"), - kotlinVersions = listOf("1.4-M2-eap-70") - ) - } - - @BeforeTest - fun prepareProjectFiles() { - val templateProjectDir = File("projects", "it-multimodule-0") - templateProjectDir.listFiles().orEmpty() - .filter { it.isFile } - .forEach { topLevelFile -> topLevelFile.copyTo(File(projectDir, topLevelFile.name)) } - File(templateProjectDir, "moduleA").copyRecursively(File(projectDir, "moduleA")) - } - - @Test - fun execute() { - val result = createGradleRunner("dokkaKdoc", ":moduleA:dokkaKdocMultimodule", "--stacktrace").build() - - assertEquals(TaskOutcome.SUCCESS, assertNotNull(result.task(":moduleA:dokkaKdocMultimodule")).outcome) - - val dokkaOutputDir = File(projectDir, "moduleA/build/dokka/kdocMultimodule") - assertTrue(dokkaOutputDir.isDirectory, "Missing dokka output directory") - - dokkaOutputDir.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 new file mode 100644 index 00000000..75ef547a --- /dev/null +++ b/integration-tests/gradle/src/integrationTest/kotlin/org/jetbrains/dokka/it/gradle/Multimodule0IntegrationTest.kt @@ -0,0 +1,61 @@ +package org.jetbrains.dokka.it.gradle + +import org.gradle.testkit.runner.TaskOutcome +import org.junit.runners.Parameterized +import java.io.File +import kotlin.test.* + +class Multimodule0IntegrationTest(override val versions: BuildVersions) : AbstractGradleIntegrationTest() { + companion object { + @get:JvmStatic + @get:Parameterized.Parameters(name = "{0}") + val versions = BuildVersions.permutations( + gradleVersions = listOf("6.5.1", "6.1.1"), + kotlinVersions = listOf("1.4-M2-eap-70") + ) + } + + @BeforeTest + fun prepareProjectFiles() { + val templateProjectDir = File("projects", "it-multimodule-0") + templateProjectDir.listFiles().orEmpty() + .filter { it.isFile } + .forEach { topLevelFile -> topLevelFile.copyTo(File(projectDir, topLevelFile.name)) } + File(templateProjectDir, "moduleA").copyRecursively(File(projectDir, "moduleA")) + } + + @Test + fun execute() { + val result = createGradleRunner("dokkaKdoc", ":moduleA:dokkaKdocMultimodule", "--stacktrace").build() + + assertEquals(TaskOutcome.SUCCESS, assertNotNull(result.task(":moduleA:dokkaKdocMultimodule")).outcome) + + val outputDir = File(projectDir, "moduleA/build/dokka/kdocMultimodule") + assertTrue(outputDir.isDirectory, "Missing dokka output directory") + + 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 -> -- cgit