From 4a3bba2fca20f0a1f49ba4da34912955a71fd5a0 Mon Sep 17 00:00:00 2001 From: Martin Bonnin Date: Sun, 7 Jan 2024 16:14:51 +0100 Subject: [PATCH] no need to overload the File version, it's working well --- .../kotlin/KotlinMultiplatformExampleTest.kt | 4 ++-- .../testExamples/kotlin/MultimoduleExampleTest.kt | 6 +++--- .../src/testExamples/kotlin/kotestUtils.kt | 12 ------------ .../kotlin/KotlinMultiplatformFunctionalTest.kt | 5 +++-- .../kotlin/MultiModuleFunctionalTest.kt | 11 ++++++----- .../src/testFunctional/kotlin/kotestUtils.kt | 7 +------ 6 files changed, 15 insertions(+), 30 deletions(-) delete mode 100644 modules/dokkatoo-plugin-integration-tests/src/testExamples/kotlin/kotestUtils.kt diff --git a/modules/dokkatoo-plugin-integration-tests/src/testExamples/kotlin/KotlinMultiplatformExampleTest.kt b/modules/dokkatoo-plugin-integration-tests/src/testExamples/kotlin/KotlinMultiplatformExampleTest.kt index f50e6c6a..93055511 100644 --- a/modules/dokkatoo-plugin-integration-tests/src/testExamples/kotlin/KotlinMultiplatformExampleTest.kt +++ b/modules/dokkatoo-plugin-integration-tests/src/testExamples/kotlin/KotlinMultiplatformExampleTest.kt @@ -11,7 +11,7 @@ import io.kotest.matchers.shouldBe import io.kotest.matchers.string.shouldContain import io.kotest.matchers.string.shouldNotContain import java.io.File -import shouldBeAnExistingFile +import shouldBeAFile class KotlinMultiplatformExampleTest : FunSpec({ @@ -106,7 +106,7 @@ class KotlinMultiplatformExampleTest : FunSpec({ dokkatooProject .findFiles { it.name == "dokka-worker.log" } .shouldBeSingleton { dokkaWorkerLog -> - dokkaWorkerLog.shouldBeAnExistingFile() + dokkaWorkerLog.shouldBeAFile() dokkaWorkerLog.readText().shouldNotContainAnyOf( "[ERROR]", "[WARN]", diff --git a/modules/dokkatoo-plugin-integration-tests/src/testExamples/kotlin/MultimoduleExampleTest.kt b/modules/dokkatoo-plugin-integration-tests/src/testExamples/kotlin/MultimoduleExampleTest.kt index 40c2caec..affc9e5a 100644 --- a/modules/dokkatoo-plugin-integration-tests/src/testExamples/kotlin/MultimoduleExampleTest.kt +++ b/modules/dokkatoo-plugin-integration-tests/src/testExamples/kotlin/MultimoduleExampleTest.kt @@ -13,7 +13,7 @@ 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 +import shouldBeAFile class MultimoduleExampleTest : FunSpec({ @@ -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]", @@ -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]", diff --git a/modules/dokkatoo-plugin-integration-tests/src/testExamples/kotlin/kotestUtils.kt b/modules/dokkatoo-plugin-integration-tests/src/testExamples/kotlin/kotestUtils.kt deleted file mode 100644 index 3fe48943..00000000 --- a/modules/dokkatoo-plugin-integration-tests/src/testExamples/kotlin/kotestUtils.kt +++ /dev/null @@ -1,12 +0,0 @@ -import io.kotest.matchers.file.shouldBeAFile -import io.kotest.matchers.file.shouldExist -import io.kotest.matchers.paths.shouldBeAFile -import io.kotest.matchers.paths.shouldExist -import java.io.File -import java.nio.file.Path - - -internal fun File.shouldBeAnExistingFile(): Unit = run { - shouldExist() - shouldBeAFile() -} \ No newline at end of file diff --git a/modules/dokkatoo-plugin/src/testFunctional/kotlin/KotlinMultiplatformFunctionalTest.kt b/modules/dokkatoo-plugin/src/testFunctional/kotlin/KotlinMultiplatformFunctionalTest.kt index 00e80bed..903ac71d 100644 --- a/modules/dokkatoo-plugin/src/testFunctional/kotlin/KotlinMultiplatformFunctionalTest.kt +++ b/modules/dokkatoo-plugin/src/testFunctional/kotlin/KotlinMultiplatformFunctionalTest.kt @@ -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 @@ -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]", @@ -53,7 +54,7 @@ class KotlinMultiplatformFunctionalTest : FunSpec({ // } test("with element-list") { - project.projectDir.resolve("build/dokka/html/test/package-list").shouldBeAnExistingFile() + project.projectDir.resolve("build/dokka/html/test/package-list").shouldBeAFile() project.projectDir.resolve("build/dokka/html/test/package-list").toFile().readText() .sortLines() .shouldContain( /* language=text */ """ diff --git a/modules/dokkatoo-plugin/src/testFunctional/kotlin/MultiModuleFunctionalTest.kt b/modules/dokkatoo-plugin/src/testFunctional/kotlin/MultiModuleFunctionalTest.kt index 64db75cd..971078ee 100644 --- a/modules/dokkatoo-plugin/src/testFunctional/kotlin/MultiModuleFunctionalTest.kt +++ b/modules/dokkatoo-plugin/src/testFunctional/kotlin/MultiModuleFunctionalTest.kt @@ -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 @@ -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]", @@ -56,7 +57,7 @@ class MultiModuleFunctionalTest : FunSpec({ // } test("with element-list") { - project.file("build/dokka/html/package-list").shouldBeAnExistingFile() + project.file("build/dokka/html/package-list").shouldBeAFile() project.file("build/dokka/html/package-list").toFile().readText() .shouldContain( /* language=text */ """ |${'$'}dokka.format:html-v1 @@ -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]", @@ -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]", @@ -229,7 +230,7 @@ class MultiModuleFunctionalTest : FunSpec({ .build { test("expect HelloAgain HTML file exists") { - helloAgainIndexHtml.shouldBeAnExistingFile() + helloAgainIndexHtml.shouldBeAFile() } test("expect :subproject-goodbye tasks are up-to-date, because no files changed") { diff --git a/modules/dokkatoo-plugin/src/testFunctional/kotlin/kotestUtils.kt b/modules/dokkatoo-plugin/src/testFunctional/kotlin/kotestUtils.kt index 1b5de410..a87f781f 100644 --- a/modules/dokkatoo-plugin/src/testFunctional/kotlin/kotestUtils.kt +++ b/modules/dokkatoo-plugin/src/testFunctional/kotlin/kotestUtils.kt @@ -7,12 +7,7 @@ import io.kotest.matchers.paths.shouldExist import java.io.File import java.nio.file.Path -internal fun Path.shouldBeAnExistingFile(): Unit = run { +internal fun Path.shouldBeAFile(): Unit = run { shouldExist() shouldBeAFile() } - -internal fun File.shouldBeAnExistingFile(): Unit = run { - shouldExist() - shouldBeAFile() -} \ No newline at end of file