aboutsummaryrefslogtreecommitdiff
path: root/integration-tests/gradle/src/test/kotlin
diff options
context:
space:
mode:
authorsebastian.sellmair <sebastian.sellmair@jetbrains.com>2020-07-01 14:30:49 +0200
committerPaweł Marks <Kordyjan@users.noreply.github.com>2020-07-02 12:48:53 +0200
commitc0ce35627413103d64845ca3c56b9ceab0606b6b (patch)
tree5eef75366a143f27a4fc61aa6fa236889b01d718 /integration-tests/gradle/src/test/kotlin
parent1bd0cba71db2330a5e827860c4fa8c5b7eda12b4 (diff)
downloaddokka-c0ce35627413103d64845ca3c56b9ceab0606b6b.tar.gz
dokka-c0ce35627413103d64845ca3c56b9ceab0606b6b.tar.bz2
dokka-c0ce35627413103d64845ca3c56b9ceab0606b6b.zip
Re-implement first basic gradle integration test
Diffstat (limited to 'integration-tests/gradle/src/test/kotlin')
-rw-r--r--integration-tests/gradle/src/test/kotlin/org/jetbrains/dokka/it/gradle/BasicTest.kt121
1 files changed, 121 insertions, 0 deletions
diff --git a/integration-tests/gradle/src/test/kotlin/org/jetbrains/dokka/it/gradle/BasicTest.kt b/integration-tests/gradle/src/test/kotlin/org/jetbrains/dokka/it/gradle/BasicTest.kt
new file mode 100644
index 00000000..deba4a16
--- /dev/null
+++ b/integration-tests/gradle/src/test/kotlin/org/jetbrains/dokka/it/gradle/BasicTest.kt
@@ -0,0 +1,121 @@
+package org.jetbrains.dokka.it.gradle
+
+import org.gradle.testkit.runner.TaskOutcome
+import java.io.File
+import kotlin.test.*
+
+class BasicTest : AbstractGradleIntegrationTest() {
+
+ @Test
+ fun `gradle 5_6_4 kotlin 1_3_72`() {
+ execute(
+ BuildVersions(
+ gradleVersion = "5.6.4",
+ kotlinVersion = "1.3.72"
+ )
+ )
+ }
+
+ @Test
+ fun `gradle 5_6_4 kotlin 1_3_30`() {
+ execute(
+ BuildVersions(
+ gradleVersion = "5.6.4",
+ kotlinVersion = "1.3.30"
+ )
+ )
+ }
+
+ @Test
+ fun `gradle 5_6_4 kotlin 1_4_M2_eap_70`() {
+ execute(
+ BuildVersions(
+ gradleVersion = "5.6.4",
+ kotlinVersion = "1.4-M2-eap-70"
+ )
+ )
+ }
+
+ @Test
+ fun `gradle 6_1_1 kotlin 1_3_72`() {
+ execute(
+ BuildVersions(
+ gradleVersion = "6.1.1",
+ kotlinVersion = "1.3.72"
+ )
+ )
+ }
+
+ @Test
+ fun `gradle 6_5_1 kotlin 1_4_M2_eap_70`() {
+ execute(
+ BuildVersions(
+ gradleVersion = "6.5.1",
+ kotlinVersion = "1.4-M2-eap-70"
+ )
+ )
+ }
+
+ @BeforeTest
+ fun prepareProjectFiles() {
+ val templateProjectDir = File("projects", "it-basic")
+
+ templateProjectDir.listFiles().orEmpty()
+ .filter { it.isFile }
+ .forEach { topLevelFile -> topLevelFile.copyTo(File(projectDir, topLevelFile.name)) }
+
+ File(templateProjectDir, "src").copyRecursively(File(projectDir, "src"))
+ }
+
+ @Test
+ fun `gradle 6_5_1 kotlin 1_3_72`() {
+ execute(
+ BuildVersions(
+ gradleVersion = "6.5.1",
+ kotlinVersion = "1.3.72"
+ )
+ )
+ }
+
+ private fun execute(versions: BuildVersions) {
+ val result = createGradleRunner(
+ buildVersions = versions,
+ arguments = arrayOf("dokka", "--stacktrace")
+ ).build()
+ assertEquals(TaskOutcome.SUCCESS, assertNotNull(result.task(":dokka")).outcome)
+
+ val dokkaOutputDir = File(projectDir, "build/dokka")
+ assertTrue(dokkaOutputDir.isDirectory, "Missing dokka output directory")
+
+ val imagesDir = File(dokkaOutputDir, "images")
+ assertTrue(imagesDir.isDirectory, "Missing images directory")
+
+ val scriptsDir = File(dokkaOutputDir, "scripts")
+ assertTrue(scriptsDir.isDirectory, "Missing scripts directory")
+
+ val stylesDir = File(dokkaOutputDir, "styles")
+ assertTrue(stylesDir.isDirectory, "Missing styles directory")
+
+ val navigationHtml = File(dokkaOutputDir, "navigation.html")
+ assertTrue(navigationHtml.isFile, "Missing navigation.html")
+
+ val moduleOutputDir = File(dokkaOutputDir, "it-basic")
+ assertTrue(moduleOutputDir.isDirectory, "Missing module directory")
+
+ val moduleIndexHtml = File(moduleOutputDir, "index.html")
+ assertTrue(moduleIndexHtml.isFile, "Missing module index.html")
+
+ val modulePackageDir = File(moduleOutputDir, "it.basic")
+ assertTrue(modulePackageDir.isDirectory, "Missing module package directory")
+
+ val modulePackageIndexHtml = File(modulePackageDir, "index.html")
+ assertTrue(modulePackageIndexHtml.isFile, "Missing module package index.html")
+
+ dokkaOutputDir.walkTopDown()
+ .filter { file -> file.extension == "html" }
+ .forEach { file ->
+ assertContainsNoErrorClass(file)
+ assertNoUnresolvedLInks(file)
+ }
+ }
+}