aboutsummaryrefslogtreecommitdiff
path: root/runners/gradle-plugin/src/test/kotlin
diff options
context:
space:
mode:
authorsebastian.sellmair <sebastian.sellmair@jetbrains.com>2020-08-10 14:41:33 +0200
committerSebastian Sellmair <34319766+sellmair@users.noreply.github.com>2020-08-14 17:51:11 +0200
commit33d962a55a559aa706649c29d9dd85d724cc37d9 (patch)
treeadbfda8bf9460d9c0f829f6ef3c93b44aa6656e8 /runners/gradle-plugin/src/test/kotlin
parent5ab8e5ffe15714886ba5fea81748241a9123d13f (diff)
downloaddokka-33d962a55a559aa706649c29d9dd85d724cc37d9.tar.gz
dokka-33d962a55a559aa706649c29d9dd85d724cc37d9.tar.bz2
dokka-33d962a55a559aa706649c29d9dd85d724cc37d9.zip
Handle wrongly implemented `DokkaMultiModuleFileLayout`
Diffstat (limited to 'runners/gradle-plugin/src/test/kotlin')
-rw-r--r--runners/gradle-plugin/src/test/kotlin/org/jetbrains/dokka/gradle/DokkaMultiModuleFileLayoutTest.kt24
1 files changed, 24 insertions, 0 deletions
diff --git a/runners/gradle-plugin/src/test/kotlin/org/jetbrains/dokka/gradle/DokkaMultiModuleFileLayoutTest.kt b/runners/gradle-plugin/src/test/kotlin/org/jetbrains/dokka/gradle/DokkaMultiModuleFileLayoutTest.kt
index 951e292f..6ec3dd57 100644
--- a/runners/gradle-plugin/src/test/kotlin/org/jetbrains/dokka/gradle/DokkaMultiModuleFileLayoutTest.kt
+++ b/runners/gradle-plugin/src/test/kotlin/org/jetbrains/dokka/gradle/DokkaMultiModuleFileLayoutTest.kt
@@ -2,11 +2,13 @@ package org.jetbrains.dokka.gradle
import org.gradle.kotlin.dsl.create
import org.gradle.testfixtures.ProjectBuilder
+import org.jetbrains.dokka.DokkaException
import org.jetbrains.dokka.gradle.DokkaMultiModuleFileLayout.CompactInParent
import org.jetbrains.dokka.gradle.DokkaMultiModuleFileLayout.NoCopy
import java.io.File
import kotlin.test.Test
import kotlin.test.assertEquals
+import kotlin.test.assertFailsWith
import kotlin.test.assertTrue
class DokkaMultiModuleFileLayoutTest {
@@ -97,4 +99,26 @@ class DokkaMultiModuleFileLayoutTest {
"Expected content to be written into 'other.file'"
)
}
+
+ @Test
+ fun `copyChildOutputDirectory target output directory within itself throws DokkaException`() {
+ val project = ProjectBuilder.builder().build()
+ val childTask = project.tasks.create<DokkaTask>("child")
+ val parentTask = project.tasks.create<DokkaMultiModuleTask>("parent")
+ parentTask.fileLayout = object : DokkaMultiModuleFileLayout {
+ override fun targetChildOutputDirectory(parent: DokkaMultiModuleTask, child: AbstractDokkaTask): File {
+ return child.outputDirectory.getSafe().resolve("subfolder")
+ }
+ }
+ assertFailsWith<DokkaException> { parentTask.copyChildOutputDirectory(childTask) }
+ }
+
+ @Test
+ fun `copyChildOutputDirectory NoCopy`() {
+ val project = ProjectBuilder.builder().build()
+ val childTask = project.tasks.create<DokkaTask>("child")
+ val parentTask = project.tasks.create<DokkaMultiModuleTask>("parent")
+ parentTask.fileLayout = NoCopy
+ parentTask.copyChildOutputDirectory(childTask)
+ }
}