Skip to content

Commit

Permalink
Add failing test for Kotlin#3863
Browse files Browse the repository at this point in the history
tbh this test isn't exactly the *cleanest*, but whatever.

Signed-off-by: solonovamax <[email protected]>
  • Loading branch information
solonovamax committed Oct 16, 2024
1 parent 7027da8 commit fe224d6
Showing 1 changed file with 49 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import io.kotest.core.spec.style.FunSpec
import io.kotest.engine.spec.tempdir
import io.kotest.inspectors.shouldForAll
import io.kotest.matchers.collections.shouldBeSingleton
import io.kotest.matchers.collections.shouldContainExactlyInAnyOrder
import io.kotest.matchers.equals.shouldNotBeEqual
import io.kotest.matchers.shouldBe
import io.kotest.matchers.string.shouldContain
Expand All @@ -25,6 +26,54 @@ import java.net.URI

class DokkaSourceSetBuilderTest : FunSpec({

context("when building a DokkaSourceSetSpec") {
val project = createProject()
test("resolve classpath, includes, samples, sourceRoots, and suppressedFiles recursively") {
fun File.ensureDirExists() = also { it.mkdirs() }
fun File.subdirWithFile() = resolve("subdir").also { it.mkdirs() }.resolve("test-file")
fun File.createFile() = also { it.createNewFile() }

val tempDir = tempdir()

val classpathDir = tempDir.resolve("classpath").ensureDirExists()
val classpathFile = classpathDir.resolve("test-file").createFile()
val classpathSubFile = classpathDir.subdirWithFile().createFile()

val includesDir = tempDir.resolve("includes").ensureDirExists()
val includesFile = includesDir.resolve("test-file").createFile()
val includesSubFile = includesDir.subdirWithFile().createFile()

val samplesDir = tempDir.resolve("samples").ensureDirExists()
val samplesFile = samplesDir.resolve("test-file").createFile()
val samplesSubFile = samplesDir.subdirWithFile().createFile()

val rootsDir = tempDir.resolve("roots").ensureDirExists()
val rootsFile = rootsDir.resolve("test-file").createFile()
val rootsSubFile = rootsDir.subdirWithFile().createFile()

val suppressedDir = tempDir.resolve("suppressed").ensureDirExists()
val suppressedFile = suppressedDir.resolve("test-file").createFile()
val suppressedSubFile = suppressedDir.subdirWithFile().createFile()


val sourceSetSpec = project.createDokkaSourceSetSpec("testRemoteLineSuffixOptional") {
classpath.from(classpathDir)
includes.from(includesDir)
samples.from(samplesDir)
sourceRoots.from(rootsDir)
suppressedFiles.from(suppressedDir)
}

val sourceSet = DokkaSourceSetBuilder.buildAll(setOf(sourceSetSpec)).single()

sourceSet.classpath shouldContainExactlyInAnyOrder listOf(classpathFile, classpathSubFile)
sourceSet.includes shouldContainExactlyInAnyOrder listOf(includesFile, includesSubFile)
sourceSet.samples shouldContainExactlyInAnyOrder listOf(samplesFile, samplesSubFile)
sourceSet.sourceRoots shouldContainExactlyInAnyOrder listOf(rootsFile, rootsSubFile)
sourceSet.suppressedFiles shouldContainExactlyInAnyOrder listOf(suppressedFile, suppressedSubFile)
}
}

context("when building a ExternalDocumentationLinkSpec") {
val project = createProject()

Expand Down

0 comments on commit fe224d6

Please sign in to comment.