Skip to content

Commit

Permalink
no need to overload the File.shouldBeAFile version, this one is worki…
Browse files Browse the repository at this point in the history
…ng well
  • Loading branch information
martinbonnin committed Jan 7, 2024
1 parent a9f3f7a commit 99d3d7e
Show file tree
Hide file tree
Showing 11 changed files with 20 additions and 37 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import dev.adamko.dokkatoo.internal.DokkatooConstants.DOKKA_VERSION
import dev.adamko.dokkatoo.utils.*
import io.kotest.assertions.withClue
import io.kotest.core.spec.style.FunSpec
import io.kotest.matchers.file.shouldBeAnExistingFile
import io.kotest.matchers.file.shouldBeAFile
import io.kotest.matchers.file.shouldHaveSameStructureAndContentAs
import io.kotest.matchers.file.shouldHaveSameStructureAs
import io.kotest.matchers.nulls.shouldNotBeNull
Expand Down Expand Up @@ -54,7 +54,7 @@ class CustomFormatExampleTest : FunSpec({
dokkatooProject
.findFiles { it.name == "dokka-worker.log" }
.shouldBeSingleton { dokkaWorkerLog ->
dokkaWorkerLog.shouldNotBeNull().shouldBeAnExistingFile()
dokkaWorkerLog.shouldNotBeNull().shouldBeAFile()
dokkaWorkerLog.readText() shouldContain "Generation completed successfully"
}
}
Expand Down Expand Up @@ -96,7 +96,7 @@ class CustomFormatExampleTest : FunSpec({
dokkatooProject
.findFiles { it.name == "dokka-worker.log" }
.shouldBeSingleton { dokkaWorkerLog ->
dokkaWorkerLog.shouldNotBeNull().shouldBeAnExistingFile()
dokkaWorkerLog.shouldNotBeNull().shouldBeAFile()
dokkaWorkerLog.readText() shouldContain "Generation completed successfully"
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import dev.adamko.dokkatoo.utils.*
import dev.adamko.dokkatoo.utils.GradleProjectTest.Companion.projectTestTempDir
import io.kotest.assertions.withClue
import io.kotest.core.spec.style.FunSpec
import io.kotest.matchers.file.shouldBeAnExistingFile
import io.kotest.matchers.file.shouldBeAFile
import io.kotest.matchers.file.shouldHaveSameStructureAndContentAs
import io.kotest.matchers.file.shouldHaveSameStructureAs
import io.kotest.matchers.nulls.shouldNotBeNull
Expand Down Expand Up @@ -56,7 +56,7 @@ class GradleExampleTest : FunSpec({
dokkatooProject
.findFiles { it.name == "dokka-worker.log" }
.shouldBeSingleton { dokkaWorkerLog ->
dokkaWorkerLog.shouldNotBeNull().shouldBeAnExistingFile()
dokkaWorkerLog.shouldNotBeNull().shouldBeAFile()
dokkaWorkerLog.readText() shouldContain "Generation completed successfully"
}
}
Expand Down Expand Up @@ -98,7 +98,7 @@ class GradleExampleTest : FunSpec({
dokkatooProject
.findFiles { it.name == "dokka-worker.log" }
.shouldBeSingleton { dokkaWorkerLog ->
dokkaWorkerLog.shouldNotBeNull().shouldBeAnExistingFile()
dokkaWorkerLog.shouldNotBeNull().shouldBeAFile()
dokkaWorkerLog.readText() shouldContain "Generation completed successfully"
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ import io.kotest.matchers.shouldBe
import io.kotest.matchers.string.shouldContain
import io.kotest.matchers.string.shouldNotContain
import java.io.File
import shouldBeAnExistingFile

class KotlinMultiplatformExampleTest : FunSpec({

Expand Down Expand Up @@ -106,7 +105,7 @@ class KotlinMultiplatformExampleTest : FunSpec({
dokkatooProject
.findFiles { it.name == "dokka-worker.log" }
.shouldBeSingleton { dokkaWorkerLog ->
dokkaWorkerLog.shouldBeAnExistingFile()
dokkaWorkerLog.shouldBeAFile()
dokkaWorkerLog.readText().shouldNotContainAnyOf(
"[ERROR]",
"[WARN]",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,14 +6,14 @@ import dev.adamko.dokkatoo.utils.GradleProjectTest.Companion.projectTestTempDir
import io.kotest.core.spec.style.FunSpec
import io.kotest.inspectors.shouldForAll
import io.kotest.matchers.collections.shouldHaveSize
import io.kotest.matchers.file.shouldBeAFile
import io.kotest.matchers.file.shouldHaveSameStructureAndContentAs
import io.kotest.matchers.file.shouldHaveSameStructureAs
import io.kotest.matchers.shouldBe
import io.kotest.matchers.string.shouldContain
import io.kotest.matchers.string.shouldNotContain
import java.io.File
import org.gradle.testkit.runner.TaskOutcome.UP_TO_DATE
import shouldBeAnExistingFile

class MultimoduleExampleTest : FunSpec({

Expand Down Expand Up @@ -59,7 +59,7 @@ class MultimoduleExampleTest : FunSpec({
dokkatooProject
.findFiles { it.name == "dokka-worker.log" }
.shouldForAll { dokkaWorkerLog ->
dokkaWorkerLog.shouldBeAnExistingFile()
dokkaWorkerLog.shouldBeAFile()
dokkaWorkerLog.readText().shouldNotContainAnyOf(
"[ERROR]",
"[WARN]",
Expand Down Expand Up @@ -108,7 +108,7 @@ class MultimoduleExampleTest : FunSpec({
dokkatooProject
.findFiles { it.name == "dokka-worker.log" }
.shouldForAll { dokkaWorkerLog ->
dokkaWorkerLog.shouldBeAnExistingFile()
dokkaWorkerLog.shouldBeAFile()
dokkaWorkerLog.readText().shouldNotContainAnyOf(
"[ERROR]",
"[WARN]",
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ package dev.adamko.dokkatoo.tests.integration

import dev.adamko.dokkatoo.utils.*
import io.kotest.core.spec.style.FunSpec
import io.kotest.matchers.file.shouldBeAnExistingFile
import io.kotest.matchers.file.shouldBeAFile
import io.kotest.matchers.file.shouldHaveSameStructureAndContentAs
import io.kotest.matchers.file.shouldHaveSameStructureAs
import io.kotest.matchers.shouldBe
Expand Down Expand Up @@ -56,7 +56,7 @@ class AndroidProjectIntegrationTest : FunSpec({
dokkatooProject
.findFiles { it.name == "dokka-worker.log" }
.shouldBeSingleton { dokkaWorkerLog ->
dokkaWorkerLog.shouldBeAnExistingFile()
dokkaWorkerLog.shouldBeAFile()
dokkaWorkerLog.readText().shouldNotContainAnyOf(
"[ERROR]",
"[WARN]",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ package dev.adamko.dokkatoo.tests.integration
import dev.adamko.dokkatoo.utils.*
import dev.adamko.dokkatoo.utils.GradleProjectTest.Companion.projectTestTempDir
import io.kotest.core.spec.style.FunSpec
import io.kotest.matchers.file.shouldBeAnExistingFile
import io.kotest.matchers.file.shouldBeAFile
import io.kotest.matchers.file.shouldHaveSameStructureAndContentAs
import io.kotest.matchers.file.shouldHaveSameStructureAs
import io.kotest.matchers.shouldBe
Expand Down Expand Up @@ -56,7 +56,7 @@ class BasicProjectIntegrationTest : FunSpec({
dokkatooProject
.findFiles { it.name == "dokka-worker.log" }
.shouldBeSingleton { dokkaWorkerLog ->
dokkaWorkerLog.shouldBeAnExistingFile()
dokkaWorkerLog.shouldBeAFile()
dokkaWorkerLog.readText().shouldNotContainAnyOf(
"[ERROR]",
"[WARN]",
Expand Down
1 change: 0 additions & 1 deletion modules/dokkatoo-plugin/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@ dependencies {
// that would be used as an implementation dependency, while dokka-core would be used as a compileOnly dependency
// https://github.com/Kotlin/dokka/issues/2933
implementation(libs.kotlin.dokkaCore)
testImplementation(project(":modules:dokkatoo-plugin-integration-tests"))

compileOnly(libs.gradlePlugin.kotlin)
compileOnly(libs.gradlePlugin.kotlin.klibCommonizerApi)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import dev.adamko.dokkatoo.utils.*
import io.kotest.assertions.withClue
import io.kotest.core.spec.style.FunSpec
import io.kotest.inspectors.shouldForAll
import io.kotest.matchers.file.shouldBeAFile
import io.kotest.matchers.sequences.shouldNotBeEmpty
import io.kotest.matchers.string.shouldContain
import io.kotest.matchers.string.shouldNotContain
Expand All @@ -31,7 +32,7 @@ class KotlinMultiplatformFunctionalTest : FunSpec({
project
.findFiles { it.name == "dokka-worker.log" }
.shouldBeSingleton { dokkaWorkerLog ->
dokkaWorkerLog.shouldBeAnExistingFile()
dokkaWorkerLog.shouldBeAFile()
dokkaWorkerLog.readText().shouldNotContainAnyOf(
"[ERROR]",
"[WARN]",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import io.kotest.core.spec.style.FunSpec
import io.kotest.inspectors.shouldForAll
import io.kotest.matchers.collections.shouldBeIn
import io.kotest.matchers.collections.shouldContainAll
import io.kotest.matchers.file.shouldBeAFile
import io.kotest.matchers.paths.shouldNotExist
import io.kotest.matchers.string.shouldBeEmpty
import io.kotest.matchers.string.shouldContain
Expand Down Expand Up @@ -34,7 +35,7 @@ class MultiModuleFunctionalTest : FunSpec({
project
.findFiles { it.name == "dokka-worker.log" }
.shouldForAll { dokkaWorkerLog ->
dokkaWorkerLog.shouldBeAnExistingFile()
dokkaWorkerLog.shouldBeAFile()
dokkaWorkerLog.readText().shouldNotContainAnyOf(
"[ERROR]",
"[WARN]",
Expand Down Expand Up @@ -100,7 +101,7 @@ class MultiModuleFunctionalTest : FunSpec({
project
.findFiles { it.name == "dokka-worker.log" }
.shouldForAll { dokkaWorkerLog ->
dokkaWorkerLog.shouldBeAnExistingFile()
dokkaWorkerLog.shouldBeAFile()
dokkaWorkerLog.readText().shouldNotContainAnyOf(
"[ERROR]",
"[WARN]",
Expand Down Expand Up @@ -166,7 +167,7 @@ class MultiModuleFunctionalTest : FunSpec({
project
.findFiles { it.name == "dokka-worker.log" }
.shouldForAll { dokkaWorkerLog ->
dokkaWorkerLog.shouldBeAnExistingFile()
dokkaWorkerLog.shouldBeAFile()
dokkaWorkerLog.readText().shouldNotContainAnyOf(
"[ERROR]",
"[WARN]",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,3 @@ internal fun Path.shouldBeAnExistingFile(): Unit = run {
shouldExist()
shouldBeAFile()
}

internal fun File.shouldBeAnExistingFile(): Unit = run {
shouldExist()
shouldBeAFile()
}

0 comments on commit 99d3d7e

Please sign in to comment.