diff options
author | sebastian.sellmair <sebastian.sellmair@jetbrains.com> | 2020-07-10 14:44:25 +0200 |
---|---|---|
committer | Sebastian Sellmair <34319766+sellmair@users.noreply.github.com> | 2020-07-13 14:23:08 +0200 |
commit | 141f0f8591ca92dadde56ae1f17732c831000c7e (patch) | |
tree | 11721c2493cfb6ad86feab2d07f08df0721f1553 /integration-tests/gradle/src | |
parent | 95e5f9d03b4e514e8718e0f61964cba64b4a57d2 (diff) | |
download | dokka-141f0f8591ca92dadde56ae1f17732c831000c7e.tar.gz dokka-141f0f8591ca92dadde56ae1f17732c831000c7e.tar.bz2 dokka-141f0f8591ca92dadde56ae1f17732c831000c7e.zip |
Implement BasicGroovyIntegrationTest.kt
Diffstat (limited to 'integration-tests/gradle/src')
-rw-r--r-- | integration-tests/gradle/src/integrationTest/kotlin/org/jetbrains/dokka/it/gradle/BasicGroovyIntegrationTest.kt | 96 |
1 files changed, 96 insertions, 0 deletions
diff --git a/integration-tests/gradle/src/integrationTest/kotlin/org/jetbrains/dokka/it/gradle/BasicGroovyIntegrationTest.kt b/integration-tests/gradle/src/integrationTest/kotlin/org/jetbrains/dokka/it/gradle/BasicGroovyIntegrationTest.kt new file mode 100644 index 00000000..ffd04ae0 --- /dev/null +++ b/integration-tests/gradle/src/integrationTest/kotlin/org/jetbrains/dokka/it/gradle/BasicGroovyIntegrationTest.kt @@ -0,0 +1,96 @@ +package org.jetbrains.dokka.it.gradle + +import org.gradle.testkit.runner.TaskOutcome +import org.junit.runners.Parameterized +import java.io.File +import kotlin.test.assertEquals +import kotlin.test.assertNotNull +import kotlin.test.assertTrue +import kotlin.test.BeforeTest +import kotlin.test.Test + +class BasicGroovyIntegrationTest(override val versions: BuildVersions) : AbstractGradleIntegrationTest() { + + companion object { + @get:JvmStatic + @get:Parameterized.Parameters(name = "{0}") + val versions = BuildVersions.permutations( + gradleVersions = listOf("6.5.1", "5.6.4"), + kotlinVersions = listOf("1.4-M2-eap-70") + ) + } + @BeforeTest + fun prepareProjectFiles() { + val templateProjectDir = File("projects", "it-basic-groovy") + + templateProjectDir.listFiles().orEmpty() + .filter { it.isFile } + .forEach { topLevelFile -> topLevelFile.copyTo(File(projectDir, topLevelFile.name)) } + + File(templateProjectDir, "src").copyRecursively(File(projectDir, "src")) + } + + @Test + fun execute() { + val result = createGradleRunner("dokkaKdoc", "dokkaJavadoc", "dokkaGfm", "dokkaJekyll", "--stacktrace").build() + + assertEquals(TaskOutcome.SUCCESS, assertNotNull(result.task(":dokkaKdoc")).outcome) + assertEquals(TaskOutcome.SUCCESS, assertNotNull(result.task(":dokkaJavadoc")).outcome) + assertEquals(TaskOutcome.SUCCESS, assertNotNull(result.task(":dokkaGfm")).outcome) + assertEquals(TaskOutcome.SUCCESS, assertNotNull(result.task(":dokkaJekyll")).outcome) + + File(projectDir, "build/dokka/customKdoc").assertKdocOutputDir() + File(projectDir, "build/dokka/customJavadoc").assertJavadocOutputDir() + File(projectDir, "build/dokka/customGfm").assertGfmOutputDir() + File(projectDir, "build/dokka/customJekyll").assertJekyllOutputDir() + } + + private fun File.assertKdocOutputDir() { + assertTrue(isDirectory, "Missing dokka kdoc output directory") + + val imagesDir = File(this, "images") + assertTrue(imagesDir.isDirectory, "Missing images directory") + + val scriptsDir = File(this, "scripts") + assertTrue(scriptsDir.isDirectory, "Missing scripts directory") + + val stylesDir = File(this, "styles") + assertTrue(stylesDir.isDirectory, "Missing styles directory") + + val navigationHtml = File(this, "navigation.html") + assertTrue(navigationHtml.isFile, "Missing navigation.html") + + val moduleOutputDir = File(this, "it-basic-groovy") + 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 it.basic package directory") + + val modulePackageIndexHtml = File(modulePackageDir, "index.html") + assertTrue(modulePackageIndexHtml.isFile, "Missing module package index.html") + + val moduleJavaPackageDir = File(moduleOutputDir, "it.basic.java") + assertTrue(moduleJavaPackageDir.isDirectory, "Missing it.basic.java package directory") + + allHtmlFiles().forEach { file -> + assertContainsNoErrorClass(file) + assertNoUnresolvedLInks(file) + assertNoHrefToMissingLocalFileOrDirectory(file) + } + } + + private fun File.assertJavadocOutputDir() { + assertTrue(isDirectory, "Missing dokka javadoc output directory") + } + + private fun File.assertGfmOutputDir() { + assertTrue(isDirectory, "Missing dokka gfm output directory") + } + + private fun File.assertJekyllOutputDir() { + assertTrue(isDirectory, "Missing dokka jekyll output directory") + } +} |