diff options
author | Kamil Doległo <kamilok1965@interia.pl> | 2020-09-16 09:29:25 +0200 |
---|---|---|
committer | Kamil Doległo <9080183+kamildoleglo@users.noreply.github.com> | 2020-11-13 19:46:36 +0100 |
commit | 1a552c1f64fc15a94c298e50a3dd614f3794c0e3 (patch) | |
tree | 5aab050b712775ef98da5041e673100c75f9ee56 /integration-tests/gradle/src/integrationTest | |
parent | e03aed7331756eaef766c7306bd033c84f7fd815 (diff) | |
download | dokka-1a552c1f64fc15a94c298e50a3dd614f3794c0e3.tar.gz dokka-1a552c1f64fc15a94c298e50a3dd614f3794c0e3.tar.bz2 dokka-1a552c1f64fc15a94c298e50a3dd614f3794c0e3.zip |
Add integration tests for Kotlin projects
Diffstat (limited to 'integration-tests/gradle/src/integrationTest')
3 files changed, 149 insertions, 0 deletions
diff --git a/integration-tests/gradle/src/integrationTest/kotlin/org/jetbrains/dokka/it/gradle/kotlin/CoroutinesGradleIntegrationTest.kt b/integration-tests/gradle/src/integrationTest/kotlin/org/jetbrains/dokka/it/gradle/kotlin/CoroutinesGradleIntegrationTest.kt new file mode 100644 index 00000000..b4978ea9 --- /dev/null +++ b/integration-tests/gradle/src/integrationTest/kotlin/org/jetbrains/dokka/it/gradle/kotlin/CoroutinesGradleIntegrationTest.kt @@ -0,0 +1,50 @@ +package org.jetbrains.dokka.it.gradle.kotlin + +import org.gradle.testkit.runner.TaskOutcome +import org.jetbrains.dokka.it.S3Project +import org.jetbrains.dokka.it.copyAndApplyGitDiff +import org.jetbrains.dokka.it.gradle.* +import org.junit.runners.Parameterized +import java.io.File +import kotlin.test.* + +class CoroutinesGradleIntegrationTest(override val versions: BuildVersions) : AbstractGradleIntegrationTest(), + S3Project { + + companion object { + @get:JvmStatic + @get:Parameterized.Parameters(name = "{0}") + val versions = BuildVersions.permutations( + gradleVersions = listOf("6.3"), + kotlinVersions = listOf("1.4.10") + ) + } + + override val projectOutputLocation: File by lazy { File(projectDir, "build/dokka/htmlMultiModule") } + + @BeforeTest + fun prepareProjectFiles() { + val templateProjectDir = File("projects", "coroutines/kotlinx-coroutines") + templateProjectDir.listFiles().orEmpty() + .forEach { topLevelFile -> topLevelFile.copyRecursively(File(projectDir, topLevelFile.name)) } + + copyAndApplyGitDiff(File("projects", "coroutines/coroutines.diff")) + } + + @Test + fun execute() { + val result = createGradleRunner(":dokkaHtmlMultiModule", "-i", "-s").buildRelaxed() + + assertEquals(TaskOutcome.SUCCESS, assertNotNull(result.task(":dokkaHtmlMultiModule")).outcome) + + assertTrue(projectOutputLocation.isDirectory, "Missing dokka output directory") + + projectOutputLocation.allHtmlFiles().forEach { file -> +// assertContainsNoErrorClass(file) +// assertNoUnresolvedLinks(file) +// assertNoHrefToMissingLocalFileOrDirectory(file) + assertNoEmptyLinks(file) + assertNoEmptySpans(file) + } + } +} diff --git a/integration-tests/gradle/src/integrationTest/kotlin/org/jetbrains/dokka/it/gradle/kotlin/SerializationGradleIntegrationTest.kt b/integration-tests/gradle/src/integrationTest/kotlin/org/jetbrains/dokka/it/gradle/kotlin/SerializationGradleIntegrationTest.kt new file mode 100644 index 00000000..e097369f --- /dev/null +++ b/integration-tests/gradle/src/integrationTest/kotlin/org/jetbrains/dokka/it/gradle/kotlin/SerializationGradleIntegrationTest.kt @@ -0,0 +1,49 @@ +package org.jetbrains.dokka.it.gradle.kotlin + +import org.gradle.testkit.runner.TaskOutcome +import org.jetbrains.dokka.it.S3Project +import org.jetbrains.dokka.it.copyAndApplyGitDiff +import org.jetbrains.dokka.it.gradle.* +import org.junit.runners.Parameterized +import java.io.File +import kotlin.test.* + +class SerializationGradleIntegrationTest(override val versions: BuildVersions) : AbstractGradleIntegrationTest(), + S3Project { + + companion object { + @get:JvmStatic + @get:Parameterized.Parameters(name = "{0}") + val versions = BuildVersions.permutations( + gradleVersions = listOf("6.3"), + kotlinVersions = listOf("1.4.10") + ) + } + + override val projectOutputLocation: File by lazy { File(projectDir, "build/dokka/htmlMultiModule") } + + @BeforeTest + fun prepareProjectFiles() { + val templateProjectDir = File("projects", "serialization/kotlinx-serialization") + templateProjectDir.listFiles().orEmpty() + .forEach { topLevelFile -> topLevelFile.copyRecursively(File(projectDir, topLevelFile.name)) } + copyAndApplyGitDiff(File("projects", "serialization/serialization.diff")) + } + + @Test + fun execute() { + val result = createGradleRunner(":dokkaHtmlMultiModule", "-i", "-s").buildRelaxed() + + assertEquals(TaskOutcome.SUCCESS, assertNotNull(result.task(":dokkaHtmlMultiModule")).outcome) + + assertTrue(projectOutputLocation.isDirectory, "Missing dokka output directory") + + projectOutputLocation.allHtmlFiles().forEach { file -> + assertContainsNoErrorClass(file) + assertNoUnresolvedLinks(file) +// assertNoHrefToMissingLocalFileOrDirectory(file) + assertNoEmptyLinks(file) + assertNoEmptySpans(file) + } + } +} diff --git a/integration-tests/gradle/src/integrationTest/kotlin/org/jetbrains/dokka/it/gradle/kotlin/StdlibGradleIntegrationTest.kt b/integration-tests/gradle/src/integrationTest/kotlin/org/jetbrains/dokka/it/gradle/kotlin/StdlibGradleIntegrationTest.kt new file mode 100644 index 00000000..ca768962 --- /dev/null +++ b/integration-tests/gradle/src/integrationTest/kotlin/org/jetbrains/dokka/it/gradle/kotlin/StdlibGradleIntegrationTest.kt @@ -0,0 +1,50 @@ +package org.jetbrains.dokka.it.gradle.kotlin + +import org.gradle.testkit.runner.TaskOutcome +import org.jetbrains.dokka.it.S3Project +import org.jetbrains.dokka.it.copyAndApplyGitDiff +import org.jetbrains.dokka.it.gradle.* +import org.junit.runners.Parameterized +import java.io.File +import kotlin.test.* + +class StdlibGradleIntegrationTest(override val versions: BuildVersions) : AbstractGradleIntegrationTest(), + S3Project { + + companion object { + @get:JvmStatic + @get:Parameterized.Parameters(name = "{0}") + val versions = BuildVersions.permutations( + gradleVersions = listOf("5.6"), + kotlinVersions = listOf("1.4.10") + ) + } + + override val projectOutputLocation: File by lazy { File(projectDir, "build/dokka/kotlin-stdlib") } + + @BeforeTest + fun prepareProjectFiles() { + val templateProjectDir = File("projects", "stdlib/kotlin-dokka-stdlib") + templateProjectDir.listFiles().orEmpty() + .forEach { topLevelFile -> topLevelFile.copyRecursively(File(projectDir, topLevelFile.name)) } + + copyAndApplyGitDiff(File("projects", "stdlib/stdlib.diff")) + } + + @Test + fun execute() { + val result = createGradleRunner("callDokka", "-i", "-s").buildRelaxed() + + assertEquals(TaskOutcome.SUCCESS, assertNotNull(result.task(":callDokka")).outcome) + + assertTrue(projectOutputLocation.isDirectory, "Missing dokka output directory") + + projectOutputLocation.allHtmlFiles().forEach { file -> + assertContainsNoErrorClass(file) +// assertNoUnresolvedLinks(file) +// assertNoHrefToMissingLocalFileOrDirectory(file) + assertNoEmptyLinks(file) + assertNoEmptySpans(file) + } + } +} |