update kotest

This commit is contained in:
Irmen de Jong 2022-06-26 18:51:03 +02:00
parent eea09f4de5
commit c75bd97537
18 changed files with 313 additions and 308 deletions

View File

@ -1,21 +1,21 @@
<component name="libraryTable"> <component name="libraryTable">
<library name="io.kotest.assertions.core.jvm" type="repository"> <library name="io.kotest.assertions.core.jvm" type="repository">
<properties maven-id="io.kotest:kotest-assertions-core-jvm:5.2.3" /> <properties maven-id="io.kotest:kotest-assertions-core-jvm:5.3.2" />
<CLASSES> <CLASSES>
<root url="jar://$MAVEN_REPOSITORY$/io/kotest/kotest-assertions-core-jvm/5.2.3/kotest-assertions-core-jvm-5.2.3.jar!/" /> <root url="jar://$MAVEN_REPOSITORY$/io/kotest/kotest-assertions-core-jvm/5.3.2/kotest-assertions-core-jvm-5.3.2.jar!/" />
<root url="jar://$MAVEN_REPOSITORY$/org/jetbrains/kotlin/kotlin-stdlib-jdk8/1.6.10/kotlin-stdlib-jdk8-1.6.10.jar!/" /> <root url="jar://$MAVEN_REPOSITORY$/org/jetbrains/kotlin/kotlin-stdlib-jdk8/1.6.21/kotlin-stdlib-jdk8-1.6.21.jar!/" />
<root url="jar://$MAVEN_REPOSITORY$/org/jetbrains/kotlin/kotlin-stdlib/1.6.10/kotlin-stdlib-1.6.10.jar!/" /> <root url="jar://$MAVEN_REPOSITORY$/org/jetbrains/kotlin/kotlin-stdlib/1.6.21/kotlin-stdlib-1.6.21.jar!/" />
<root url="jar://$MAVEN_REPOSITORY$/org/jetbrains/annotations/13.0/annotations-13.0.jar!/" /> <root url="jar://$MAVEN_REPOSITORY$/org/jetbrains/annotations/13.0/annotations-13.0.jar!/" />
<root url="jar://$MAVEN_REPOSITORY$/org/jetbrains/kotlin/kotlin-stdlib-jdk7/1.6.10/kotlin-stdlib-jdk7-1.6.10.jar!/" /> <root url="jar://$MAVEN_REPOSITORY$/org/jetbrains/kotlin/kotlin-stdlib-jdk7/1.6.21/kotlin-stdlib-jdk7-1.6.21.jar!/" />
<root url="jar://$MAVEN_REPOSITORY$/io/kotest/kotest-assertions-shared-jvm/5.2.3/kotest-assertions-shared-jvm-5.2.3.jar!/" /> <root url="jar://$MAVEN_REPOSITORY$/io/kotest/kotest-assertions-shared-jvm/5.3.2/kotest-assertions-shared-jvm-5.3.2.jar!/" />
<root url="jar://$MAVEN_REPOSITORY$/io/github/java-diff-utils/java-diff-utils/4.11/java-diff-utils-4.11.jar!/" /> <root url="jar://$MAVEN_REPOSITORY$/io/github/java-diff-utils/java-diff-utils/4.11/java-diff-utils-4.11.jar!/" />
<root url="jar://$MAVEN_REPOSITORY$/org/opentest4j/opentest4j/1.2.0/opentest4j-1.2.0.jar!/" /> <root url="jar://$MAVEN_REPOSITORY$/org/opentest4j/opentest4j/1.2.0/opentest4j-1.2.0.jar!/" />
<root url="jar://$MAVEN_REPOSITORY$/org/jetbrains/kotlinx/kotlinx-coroutines-jdk8/1.6.1/kotlinx-coroutines-jdk8-1.6.1.jar!/" /> <root url="jar://$MAVEN_REPOSITORY$/org/jetbrains/kotlinx/kotlinx-coroutines-jdk8/1.6.1/kotlinx-coroutines-jdk8-1.6.1.jar!/" />
<root url="jar://$MAVEN_REPOSITORY$/org/jetbrains/kotlin/kotlin-reflect/1.6.10/kotlin-reflect-1.6.10.jar!/" /> <root url="jar://$MAVEN_REPOSITORY$/org/jetbrains/kotlin/kotlin-reflect/1.6.21/kotlin-reflect-1.6.21.jar!/" />
<root url="jar://$MAVEN_REPOSITORY$/org/jetbrains/kotlinx/kotlinx-coroutines-core-jvm/1.6.1/kotlinx-coroutines-core-jvm-1.6.1.jar!/" /> <root url="jar://$MAVEN_REPOSITORY$/org/jetbrains/kotlinx/kotlinx-coroutines-core-jvm/1.6.1/kotlinx-coroutines-core-jvm-1.6.1.jar!/" />
<root url="jar://$MAVEN_REPOSITORY$/org/jetbrains/kotlin/kotlin-stdlib-common/1.6.0/kotlin-stdlib-common-1.6.0.jar!/" /> <root url="jar://$MAVEN_REPOSITORY$/org/jetbrains/kotlin/kotlin-stdlib-common/1.6.0/kotlin-stdlib-common-1.6.0.jar!/" />
<root url="jar://$MAVEN_REPOSITORY$/io/kotest/kotest-common-jvm/5.2.3/kotest-common-jvm-5.2.3.jar!/" /> <root url="jar://$MAVEN_REPOSITORY$/io/kotest/kotest-common-jvm/5.3.2/kotest-common-jvm-5.3.2.jar!/" />
<root url="jar://$MAVEN_REPOSITORY$/io/kotest/kotest-assertions-api-jvm/5.2.3/kotest-assertions-api-jvm-5.2.3.jar!/" /> <root url="jar://$MAVEN_REPOSITORY$/io/kotest/kotest-assertions-api-jvm/5.3.2/kotest-assertions-api-jvm-5.3.2.jar!/" />
</CLASSES> </CLASSES>
<JAVADOC /> <JAVADOC />
<SOURCES /> <SOURCES />

View File

@ -1,20 +1,20 @@
<component name="libraryTable"> <component name="libraryTable">
<library name="io.kotest.property.jvm" type="repository"> <library name="io.kotest.property.jvm" type="repository">
<properties maven-id="io.kotest:kotest-property-jvm:5.2.3" /> <properties maven-id="io.kotest:kotest-property-jvm:5.3.2" />
<CLASSES> <CLASSES>
<root url="jar://$MAVEN_REPOSITORY$/io/kotest/kotest-property-jvm/5.2.3/kotest-property-jvm-5.2.3.jar!/" /> <root url="jar://$MAVEN_REPOSITORY$/io/kotest/kotest-property-jvm/5.3.2/kotest-property-jvm-5.3.2.jar!/" />
<root url="jar://$MAVEN_REPOSITORY$/com/github/curious-odd-man/rgxgen/1.3/rgxgen-1.3.jar!/" /> <root url="jar://$MAVEN_REPOSITORY$/com/github/curious-odd-man/rgxgen/1.3/rgxgen-1.3.jar!/" />
<root url="jar://$MAVEN_REPOSITORY$/org/jetbrains/kotlin/kotlin-stdlib-jdk8/1.6.10/kotlin-stdlib-jdk8-1.6.10.jar!/" /> <root url="jar://$MAVEN_REPOSITORY$/org/jetbrains/kotlin/kotlin-stdlib-jdk8/1.6.21/kotlin-stdlib-jdk8-1.6.21.jar!/" />
<root url="jar://$MAVEN_REPOSITORY$/org/jetbrains/kotlin/kotlin-stdlib/1.6.10/kotlin-stdlib-1.6.10.jar!/" /> <root url="jar://$MAVEN_REPOSITORY$/org/jetbrains/kotlin/kotlin-stdlib/1.6.21/kotlin-stdlib-1.6.21.jar!/" />
<root url="jar://$MAVEN_REPOSITORY$/org/jetbrains/annotations/13.0/annotations-13.0.jar!/" /> <root url="jar://$MAVEN_REPOSITORY$/org/jetbrains/annotations/13.0/annotations-13.0.jar!/" />
<root url="jar://$MAVEN_REPOSITORY$/org/jetbrains/kotlin/kotlin-stdlib-jdk7/1.6.10/kotlin-stdlib-jdk7-1.6.10.jar!/" /> <root url="jar://$MAVEN_REPOSITORY$/org/jetbrains/kotlin/kotlin-stdlib-jdk7/1.6.21/kotlin-stdlib-jdk7-1.6.21.jar!/" />
<root url="jar://$MAVEN_REPOSITORY$/io/kotest/kotest-common-jvm/5.2.3/kotest-common-jvm-5.2.3.jar!/" /> <root url="jar://$MAVEN_REPOSITORY$/io/kotest/kotest-common-jvm/5.3.2/kotest-common-jvm-5.3.2.jar!/" />
<root url="jar://$MAVEN_REPOSITORY$/io/kotest/kotest-assertions-shared-jvm/5.2.3/kotest-assertions-shared-jvm-5.2.3.jar!/" /> <root url="jar://$MAVEN_REPOSITORY$/io/kotest/kotest-assertions-shared-jvm/5.3.2/kotest-assertions-shared-jvm-5.3.2.jar!/" />
<root url="jar://$MAVEN_REPOSITORY$/io/kotest/kotest-assertions-api-jvm/5.2.3/kotest-assertions-api-jvm-5.2.3.jar!/" /> <root url="jar://$MAVEN_REPOSITORY$/io/kotest/kotest-assertions-api-jvm/5.3.2/kotest-assertions-api-jvm-5.3.2.jar!/" />
<root url="jar://$MAVEN_REPOSITORY$/org/jetbrains/kotlinx/kotlinx-coroutines-jdk8/1.6.1/kotlinx-coroutines-jdk8-1.6.1.jar!/" /> <root url="jar://$MAVEN_REPOSITORY$/org/jetbrains/kotlinx/kotlinx-coroutines-jdk8/1.6.1/kotlinx-coroutines-jdk8-1.6.1.jar!/" />
<root url="jar://$MAVEN_REPOSITORY$/org/opentest4j/opentest4j/1.2.0/opentest4j-1.2.0.jar!/" /> <root url="jar://$MAVEN_REPOSITORY$/org/opentest4j/opentest4j/1.2.0/opentest4j-1.2.0.jar!/" />
<root url="jar://$MAVEN_REPOSITORY$/io/github/java-diff-utils/java-diff-utils/4.11/java-diff-utils-4.11.jar!/" /> <root url="jar://$MAVEN_REPOSITORY$/io/github/java-diff-utils/java-diff-utils/4.11/java-diff-utils-4.11.jar!/" />
<root url="jar://$MAVEN_REPOSITORY$/org/jetbrains/kotlin/kotlin-reflect/1.6.10/kotlin-reflect-1.6.10.jar!/" /> <root url="jar://$MAVEN_REPOSITORY$/org/jetbrains/kotlin/kotlin-reflect/1.6.21/kotlin-reflect-1.6.21.jar!/" />
<root url="jar://$MAVEN_REPOSITORY$/org/jetbrains/kotlinx/kotlinx-coroutines-core-jvm/1.6.1/kotlinx-coroutines-core-jvm-1.6.1.jar!/" /> <root url="jar://$MAVEN_REPOSITORY$/org/jetbrains/kotlinx/kotlinx-coroutines-core-jvm/1.6.1/kotlinx-coroutines-core-jvm-1.6.1.jar!/" />
<root url="jar://$MAVEN_REPOSITORY$/org/jetbrains/kotlin/kotlin-stdlib-common/1.6.0/kotlin-stdlib-common-1.6.0.jar!/" /> <root url="jar://$MAVEN_REPOSITORY$/org/jetbrains/kotlin/kotlin-stdlib-common/1.6.0/kotlin-stdlib-common-1.6.0.jar!/" />
</CLASSES> </CLASSES>

View File

@ -1,38 +1,38 @@
<component name="libraryTable"> <component name="libraryTable">
<library name="io.kotest.runner.junit5.jvm" type="repository"> <library name="io.kotest.runner.junit5.jvm" type="repository">
<properties maven-id="io.kotest:kotest-runner-junit5-jvm:5.2.3" /> <properties maven-id="io.kotest:kotest-runner-junit5-jvm:5.3.2" />
<CLASSES> <CLASSES>
<root url="jar://$MAVEN_REPOSITORY$/io/kotest/kotest-runner-junit5-jvm/5.2.3/kotest-runner-junit5-jvm-5.2.3.jar!/" /> <root url="jar://$MAVEN_REPOSITORY$/io/kotest/kotest-runner-junit5-jvm/5.3.2/kotest-runner-junit5-jvm-5.3.2.jar!/" />
<root url="jar://$MAVEN_REPOSITORY$/io/kotest/kotest-framework-api-jvm/5.2.3/kotest-framework-api-jvm-5.2.3.jar!/" /> <root url="jar://$MAVEN_REPOSITORY$/io/kotest/kotest-framework-api-jvm/5.3.2/kotest-framework-api-jvm-5.3.2.jar!/" />
<root url="jar://$MAVEN_REPOSITORY$/io/kotest/kotest-assertions-shared-jvm/5.2.3/kotest-assertions-shared-jvm-5.2.3.jar!/" /> <root url="jar://$MAVEN_REPOSITORY$/io/kotest/kotest-assertions-shared-jvm/5.3.2/kotest-assertions-shared-jvm-5.3.2.jar!/" />
<root url="jar://$MAVEN_REPOSITORY$/io/github/java-diff-utils/java-diff-utils/4.11/java-diff-utils-4.11.jar!/" /> <root url="jar://$MAVEN_REPOSITORY$/io/github/java-diff-utils/java-diff-utils/4.11/java-diff-utils-4.11.jar!/" />
<root url="jar://$MAVEN_REPOSITORY$/org/jetbrains/kotlinx/kotlinx-coroutines-test-jvm/1.6.1/kotlinx-coroutines-test-jvm-1.6.1.jar!/" /> <root url="jar://$MAVEN_REPOSITORY$/org/jetbrains/kotlinx/kotlinx-coroutines-test-jvm/1.6.1/kotlinx-coroutines-test-jvm-1.6.1.jar!/" />
<root url="jar://$MAVEN_REPOSITORY$/io/kotest/kotest-common-jvm/5.2.3/kotest-common-jvm-5.2.3.jar!/" /> <root url="jar://$MAVEN_REPOSITORY$/io/kotest/kotest-common-jvm/5.3.2/kotest-common-jvm-5.3.2.jar!/" />
<root url="jar://$MAVEN_REPOSITORY$/io/kotest/kotest-framework-engine-jvm/5.2.3/kotest-framework-engine-jvm-5.2.3.jar!/" /> <root url="jar://$MAVEN_REPOSITORY$/io/kotest/kotest-framework-engine-jvm/5.3.2/kotest-framework-engine-jvm-5.3.2.jar!/" />
<root url="jar://$MAVEN_REPOSITORY$/io/github/classgraph/classgraph/4.8.138/classgraph-4.8.138.jar!/" /> <root url="jar://$MAVEN_REPOSITORY$/io/github/classgraph/classgraph/4.8.146/classgraph-4.8.146.jar!/" />
<root url="jar://$MAVEN_REPOSITORY$/com/github/ajalt/mordant/1.2.1/mordant-1.2.1.jar!/" /> <root url="jar://$MAVEN_REPOSITORY$/com/github/ajalt/mordant/1.2.1/mordant-1.2.1.jar!/" />
<root url="jar://$MAVEN_REPOSITORY$/com/github/ajalt/colormath/1.2.0/colormath-1.2.0.jar!/" /> <root url="jar://$MAVEN_REPOSITORY$/com/github/ajalt/colormath/1.2.0/colormath-1.2.0.jar!/" />
<root url="jar://$MAVEN_REPOSITORY$/org/opentest4j/opentest4j/1.2.0/opentest4j-1.2.0.jar!/" /> <root url="jar://$MAVEN_REPOSITORY$/org/opentest4j/opentest4j/1.2.0/opentest4j-1.2.0.jar!/" />
<root url="jar://$MAVEN_REPOSITORY$/org/jetbrains/kotlinx/kotlinx-coroutines-debug/1.6.1/kotlinx-coroutines-debug-1.6.1.jar!/" /> <root url="jar://$MAVEN_REPOSITORY$/org/jetbrains/kotlinx/kotlinx-coroutines-debug/1.6.1/kotlinx-coroutines-debug-1.6.1.jar!/" />
<root url="jar://$MAVEN_REPOSITORY$/net/java/dev/jna/jna/5.9.0/jna-5.9.0.jar!/" /> <root url="jar://$MAVEN_REPOSITORY$/net/java/dev/jna/jna/5.9.0/jna-5.9.0.jar!/" />
<root url="jar://$MAVEN_REPOSITORY$/net/java/dev/jna/jna-platform/5.9.0/jna-platform-5.9.0.jar!/" /> <root url="jar://$MAVEN_REPOSITORY$/net/java/dev/jna/jna-platform/5.9.0/jna-platform-5.9.0.jar!/" />
<root url="jar://$MAVEN_REPOSITORY$/io/kotest/kotest-framework-discovery-jvm/5.2.3/kotest-framework-discovery-jvm-5.2.3.jar!/" /> <root url="jar://$MAVEN_REPOSITORY$/io/kotest/kotest-framework-discovery-jvm/5.3.2/kotest-framework-discovery-jvm-5.3.2.jar!/" />
<root url="jar://$MAVEN_REPOSITORY$/io/kotest/kotest-assertions-core-jvm/5.2.3/kotest-assertions-core-jvm-5.2.3.jar!/" /> <root url="jar://$MAVEN_REPOSITORY$/io/kotest/kotest-assertions-core-jvm/5.3.2/kotest-assertions-core-jvm-5.3.2.jar!/" />
<root url="jar://$MAVEN_REPOSITORY$/org/jetbrains/kotlinx/kotlinx-coroutines-jdk8/1.6.1/kotlinx-coroutines-jdk8-1.6.1.jar!/" /> <root url="jar://$MAVEN_REPOSITORY$/org/jetbrains/kotlinx/kotlinx-coroutines-jdk8/1.6.1/kotlinx-coroutines-jdk8-1.6.1.jar!/" />
<root url="jar://$MAVEN_REPOSITORY$/io/kotest/kotest-assertions-api-jvm/5.2.3/kotest-assertions-api-jvm-5.2.3.jar!/" /> <root url="jar://$MAVEN_REPOSITORY$/io/kotest/kotest-assertions-api-jvm/5.3.2/kotest-assertions-api-jvm-5.3.2.jar!/" />
<root url="jar://$MAVEN_REPOSITORY$/io/kotest/kotest-extensions-jvm/5.2.3/kotest-extensions-jvm-5.2.3.jar!/" /> <root url="jar://$MAVEN_REPOSITORY$/io/kotest/kotest-extensions-jvm/5.3.2/kotest-extensions-jvm-5.3.2.jar!/" />
<root url="jar://$MAVEN_REPOSITORY$/commons-io/commons-io/2.11.0/commons-io-2.11.0.jar!/" /> <root url="jar://$MAVEN_REPOSITORY$/commons-io/commons-io/2.11.0/commons-io-2.11.0.jar!/" />
<root url="jar://$MAVEN_REPOSITORY$/io/mockk/mockk/1.12.2/mockk-1.12.2.jar!/" /> <root url="jar://$MAVEN_REPOSITORY$/io/mockk/mockk/1.12.3/mockk-1.12.3.jar!/" />
<root url="jar://$MAVEN_REPOSITORY$/io/mockk/mockk-dsl-jvm/1.12.2/mockk-dsl-jvm-1.12.2.jar!/" /> <root url="jar://$MAVEN_REPOSITORY$/io/mockk/mockk-common/1.12.3/mockk-common-1.12.3.jar!/" />
<root url="jar://$MAVEN_REPOSITORY$/io/mockk/mockk-dsl/1.12.2/mockk-dsl-1.12.2.jar!/" /> <root url="jar://$MAVEN_REPOSITORY$/io/mockk/mockk-dsl/1.12.3/mockk-dsl-1.12.3.jar!/" />
<root url="jar://$MAVEN_REPOSITORY$/io/mockk/mockk-common/1.12.2/mockk-common-1.12.2.jar!/" /> <root url="jar://$MAVEN_REPOSITORY$/io/mockk/mockk-dsl-jvm/1.12.3/mockk-dsl-jvm-1.12.3.jar!/" />
<root url="jar://$MAVEN_REPOSITORY$/io/mockk/mockk-agent-jvm/1.12.2/mockk-agent-jvm-1.12.2.jar!/" /> <root url="jar://$MAVEN_REPOSITORY$/io/mockk/mockk-agent-jvm/1.12.3/mockk-agent-jvm-1.12.3.jar!/" />
<root url="jar://$MAVEN_REPOSITORY$/io/mockk/mockk-agent-api/1.12.2/mockk-agent-api-1.12.2.jar!/" /> <root url="jar://$MAVEN_REPOSITORY$/io/mockk/mockk-agent-api/1.12.3/mockk-agent-api-1.12.3.jar!/" />
<root url="jar://$MAVEN_REPOSITORY$/io/mockk/mockk-agent-common/1.12.2/mockk-agent-common-1.12.2.jar!/" /> <root url="jar://$MAVEN_REPOSITORY$/io/mockk/mockk-agent-common/1.12.3/mockk-agent-common-1.12.3.jar!/" />
<root url="jar://$MAVEN_REPOSITORY$/org/objenesis/objenesis/3.1/objenesis-3.1.jar!/" /> <root url="jar://$MAVEN_REPOSITORY$/org/objenesis/objenesis/3.1/objenesis-3.1.jar!/" />
<root url="jar://$MAVEN_REPOSITORY$/net/bytebuddy/byte-buddy/1.12.5/byte-buddy-1.12.5.jar!/" /> <root url="jar://$MAVEN_REPOSITORY$/net/bytebuddy/byte-buddy/1.12.6/byte-buddy-1.12.6.jar!/" />
<root url="jar://$MAVEN_REPOSITORY$/net/bytebuddy/byte-buddy-agent/1.12.5/byte-buddy-agent-1.12.5.jar!/" /> <root url="jar://$MAVEN_REPOSITORY$/net/bytebuddy/byte-buddy-agent/1.12.6/byte-buddy-agent-1.12.6.jar!/" />
<root url="jar://$MAVEN_REPOSITORY$/io/kotest/kotest-framework-concurrency-jvm/5.2.3/kotest-framework-concurrency-jvm-5.2.3.jar!/" /> <root url="jar://$MAVEN_REPOSITORY$/io/kotest/kotest-framework-concurrency-jvm/5.3.2/kotest-framework-concurrency-jvm-5.3.2.jar!/" />
<root url="jar://$MAVEN_REPOSITORY$/org/jetbrains/kotlinx/kotlinx-coroutines-core-jvm/1.6.1/kotlinx-coroutines-core-jvm-1.6.1.jar!/" /> <root url="jar://$MAVEN_REPOSITORY$/org/jetbrains/kotlinx/kotlinx-coroutines-core-jvm/1.6.1/kotlinx-coroutines-core-jvm-1.6.1.jar!/" />
<root url="jar://$MAVEN_REPOSITORY$/org/jetbrains/kotlin/kotlin-stdlib-common/1.6.0/kotlin-stdlib-common-1.6.0.jar!/" /> <root url="jar://$MAVEN_REPOSITORY$/org/jetbrains/kotlin/kotlin-stdlib-common/1.6.0/kotlin-stdlib-common-1.6.0.jar!/" />
<root url="jar://$MAVEN_REPOSITORY$/org/junit/platform/junit-platform-engine/1.7.2/junit-platform-engine-1.7.2.jar!/" /> <root url="jar://$MAVEN_REPOSITORY$/org/junit/platform/junit-platform-engine/1.7.2/junit-platform-engine-1.7.2.jar!/" />
@ -41,11 +41,11 @@
<root url="jar://$MAVEN_REPOSITORY$/org/junit/platform/junit-platform-suite-api/1.7.2/junit-platform-suite-api-1.7.2.jar!/" /> <root url="jar://$MAVEN_REPOSITORY$/org/junit/platform/junit-platform-suite-api/1.7.2/junit-platform-suite-api-1.7.2.jar!/" />
<root url="jar://$MAVEN_REPOSITORY$/org/junit/platform/junit-platform-launcher/1.7.2/junit-platform-launcher-1.7.2.jar!/" /> <root url="jar://$MAVEN_REPOSITORY$/org/junit/platform/junit-platform-launcher/1.7.2/junit-platform-launcher-1.7.2.jar!/" />
<root url="jar://$MAVEN_REPOSITORY$/org/junit/jupiter/junit-jupiter-api/5.7.2/junit-jupiter-api-5.7.2.jar!/" /> <root url="jar://$MAVEN_REPOSITORY$/org/junit/jupiter/junit-jupiter-api/5.7.2/junit-jupiter-api-5.7.2.jar!/" />
<root url="jar://$MAVEN_REPOSITORY$/org/jetbrains/kotlin/kotlin-stdlib-jdk8/1.6.10/kotlin-stdlib-jdk8-1.6.10.jar!/" /> <root url="jar://$MAVEN_REPOSITORY$/org/jetbrains/kotlin/kotlin-stdlib-jdk8/1.6.21/kotlin-stdlib-jdk8-1.6.21.jar!/" />
<root url="jar://$MAVEN_REPOSITORY$/org/jetbrains/kotlin/kotlin-stdlib/1.6.10/kotlin-stdlib-1.6.10.jar!/" /> <root url="jar://$MAVEN_REPOSITORY$/org/jetbrains/kotlin/kotlin-stdlib/1.6.21/kotlin-stdlib-1.6.21.jar!/" />
<root url="jar://$MAVEN_REPOSITORY$/org/jetbrains/annotations/13.0/annotations-13.0.jar!/" /> <root url="jar://$MAVEN_REPOSITORY$/org/jetbrains/annotations/13.0/annotations-13.0.jar!/" />
<root url="jar://$MAVEN_REPOSITORY$/org/jetbrains/kotlin/kotlin-stdlib-jdk7/1.6.10/kotlin-stdlib-jdk7-1.6.10.jar!/" /> <root url="jar://$MAVEN_REPOSITORY$/org/jetbrains/kotlin/kotlin-stdlib-jdk7/1.6.21/kotlin-stdlib-jdk7-1.6.21.jar!/" />
<root url="jar://$MAVEN_REPOSITORY$/org/jetbrains/kotlin/kotlin-reflect/1.6.10/kotlin-reflect-1.6.10.jar!/" /> <root url="jar://$MAVEN_REPOSITORY$/org/jetbrains/kotlin/kotlin-reflect/1.6.21/kotlin-reflect-1.6.21.jar!/" />
</CLASSES> </CLASSES>
<JAVADOC /> <JAVADOC />
<SOURCES /> <SOURCES />

View File

@ -40,7 +40,7 @@ dependencies {
implementation 'org.jetbrains.kotlinx:kotlinx-cli:0.3.4' implementation 'org.jetbrains.kotlinx:kotlinx-cli:0.3.4'
implementation "com.michael-bull.kotlin-result:kotlin-result-jvm:1.1.16" implementation "com.michael-bull.kotlin-result:kotlin-result-jvm:1.1.16"
testImplementation 'io.kotest:kotest-runner-junit5-jvm:5.2.3' testImplementation 'io.kotest:kotest-runner-junit5-jvm:5.3.2'
} }
configurations.all { configurations.all {

View File

@ -39,9 +39,9 @@ class TestModuleImporter: FunSpec({
context("WithInvalidPath") { context("WithInvalidPath") {
test("testNonexisting") { test("testNonexisting") {
val dirRel = Helpers.assumeDirectory(".", Helpers.workingDir.relativize(Helpers.fixturesDir)) val dirRel = assumeDirectory(".", workingDir.relativize(fixturesDir))
val importer = makeImporter(null, dirRel.invariantSeparatorsPathString) val importer = makeImporter(null, dirRel.invariantSeparatorsPathString)
val srcPathRel = Helpers.assumeNotExists(dirRel, "i_do_not_exist") val srcPathRel = assumeNotExists(dirRel, "i_do_not_exist")
val srcPathAbs = srcPathRel.absolute() val srcPathAbs = srcPathRel.absolute()
val error1 = importer.importModule(srcPathRel).getErrorOrElse { fail("should have import error") } val error1 = importer.importModule(srcPathRel).getErrorOrElse { fail("should have import error") }
withClue(".file should be normalized") { withClue(".file should be normalized") {
@ -62,7 +62,7 @@ class TestModuleImporter: FunSpec({
} }
test("testDirectory") { test("testDirectory") {
val srcPathRel = Helpers.assumeDirectory(Helpers.workingDir.relativize(Helpers.fixturesDir)) val srcPathRel = assumeDirectory(workingDir.relativize(fixturesDir))
val srcPathAbs = srcPathRel.absolute() val srcPathAbs = srcPathRel.absolute()
val searchIn = Path(".", "$srcPathRel").invariantSeparatorsPathString val searchIn = Path(".", "$srcPathRel").invariantSeparatorsPathString
val importer = makeImporter(null, searchIn) val importer = makeImporter(null, searchIn)
@ -95,11 +95,11 @@ class TestModuleImporter: FunSpec({
test("testAbsolute") { test("testAbsolute") {
val searchIn = listOf( val searchIn = listOf(
Path(".").div(Helpers.workingDir.relativize(Helpers.fixturesDir)), // we do want a dot "." in front Path(".").div(workingDir.relativize(fixturesDir)), // we do want a dot "." in front
).map { it.invariantSeparatorsPathString } ).map { it.invariantSeparatorsPathString }
val importer = makeImporter(null, searchIn) val importer = makeImporter(null, searchIn)
val fileName = "ast_simple_main.p8" val fileName = "ast_simple_main.p8"
val path = Helpers.assumeReadableFile(searchIn[0], fileName) val path = assumeReadableFile(searchIn[0], fileName)
val module = importer.importModule(path.absolute()).getOrElse { throw it } val module = importer.importModule(path.absolute()).getOrElse { throw it }
program.modules.size shouldBe 2 program.modules.size shouldBe 2
@ -109,11 +109,11 @@ class TestModuleImporter: FunSpec({
test("testRelativeToWorkingDir") { test("testRelativeToWorkingDir") {
val searchIn = listOf( val searchIn = listOf(
Path(".").div(Helpers.workingDir.relativize(Helpers.fixturesDir)), // we do want a dot "." in front Path(".").div(workingDir.relativize(fixturesDir)), // we do want a dot "." in front
).map { it.invariantSeparatorsPathString } ).map { it.invariantSeparatorsPathString }
val importer = makeImporter(null, searchIn) val importer = makeImporter(null, searchIn)
val fileName = "ast_simple_main.p8" val fileName = "ast_simple_main.p8"
val path = Helpers.assumeReadableFile(searchIn[0], fileName) val path = assumeReadableFile(searchIn[0], fileName)
withClue("sanity check: path should NOT be absolute") { withClue("sanity check: path should NOT be absolute") {
path.isAbsolute shouldBe false path.isAbsolute shouldBe false
} }
@ -126,12 +126,12 @@ class TestModuleImporter: FunSpec({
test("testRelativeTo1stDirInSearchList") { test("testRelativeTo1stDirInSearchList") {
val searchIn = Path(".") val searchIn = Path(".")
.div(Helpers.workingDir.relativize(Helpers.fixturesDir)) .div(workingDir.relativize(fixturesDir))
.invariantSeparatorsPathString .invariantSeparatorsPathString
val importer = makeImporter(null, searchIn) val importer = makeImporter(null, searchIn)
val fileName = "ast_simple_main.p8" val fileName = "ast_simple_main.p8"
val path = Path(".", fileName) val path = Path(".", fileName)
Helpers.assumeReadableFile(searchIn, path) assumeReadableFile(searchIn, path)
val module = importer.importModule(path).getOrElse { throw it } val module = importer.importModule(path).getOrElse { throw it }
program.modules.size shouldBe 2 program.modules.size shouldBe 2
@ -141,9 +141,9 @@ class TestModuleImporter: FunSpec({
context("WithBadFile") { context("WithBadFile") {
test("testWithSyntaxError") { test("testWithSyntaxError") {
val searchIn = Helpers.assumeDirectory("./", Helpers.workingDir.relativize(Helpers.fixturesDir)) val searchIn = assumeDirectory("./", workingDir.relativize(fixturesDir))
val importer = makeImporter(null, searchIn.invariantSeparatorsPathString) val importer = makeImporter(null, searchIn.invariantSeparatorsPathString)
val srcPath = Helpers.assumeReadableFile(Helpers.fixturesDir, "ast_file_with_syntax_error.p8") val srcPath = assumeReadableFile(fixturesDir, "ast_file_with_syntax_error.p8")
val act = { importer.importModule(srcPath) } val act = { importer.importModule(srcPath) }
@ -160,10 +160,10 @@ class TestModuleImporter: FunSpec({
} }
fun doTestImportingFileWithSyntaxError(repetitions: Int) { fun doTestImportingFileWithSyntaxError(repetitions: Int) {
val searchIn = Helpers.assumeDirectory("./", Helpers.workingDir.relativize(Helpers.fixturesDir)) val searchIn = assumeDirectory("./", workingDir.relativize(fixturesDir))
val importer = makeImporter(null, searchIn.invariantSeparatorsPathString) val importer = makeImporter(null, searchIn.invariantSeparatorsPathString)
val importing = Helpers.assumeReadableFile(Helpers.fixturesDir, "import_file_with_syntax_error.p8") val importing = assumeReadableFile(fixturesDir, "import_file_with_syntax_error.p8")
val imported = Helpers.assumeReadableFile(Helpers.fixturesDir, "file_with_syntax_error.p8") val imported = assumeReadableFile(fixturesDir, "file_with_syntax_error.p8")
val act = { importer.importModule(importing) } val act = { importer.importModule(importing) }
@ -194,11 +194,11 @@ class TestModuleImporter: FunSpec({
context("ImportLibraryModule") { context("ImportLibraryModule") {
context("WithInvalidName") { context("WithInvalidName") {
test("testWithNonExistingName") { test("testWithNonExistingName") {
val searchIn = Helpers.assumeDirectory("./", Helpers.workingDir.relativize(Helpers.fixturesDir)) val searchIn = assumeDirectory("./", workingDir.relativize(fixturesDir))
val errors = ErrorReporterForTests(false) val errors = ErrorReporterForTests(false)
val importer = makeImporter(errors, searchIn.invariantSeparatorsPathString) val importer = makeImporter(errors, searchIn.invariantSeparatorsPathString)
val filenameNoExt = Helpers.assumeNotExists(Helpers.fixturesDir, "i_do_not_exist").name val filenameNoExt = assumeNotExists(fixturesDir, "i_do_not_exist").name
val filenameWithExt = Helpers.assumeNotExists(Helpers.fixturesDir, "i_do_not_exist.p8").name val filenameWithExt = assumeNotExists(fixturesDir, "i_do_not_exist.p8").name
repeat(2) { n -> repeat(2) { n ->
val result = importer.importLibraryModule(filenameNoExt) val result = importer.importLibraryModule(filenameNoExt)
@ -221,9 +221,9 @@ class TestModuleImporter: FunSpec({
context("WithValidName") { context("WithValidName") {
context("WithBadFile") { context("WithBadFile") {
test("testWithSyntaxError") { test("testWithSyntaxError") {
val searchIn = Helpers.assumeDirectory("./", Helpers.workingDir.relativize(Helpers.fixturesDir)) val searchIn = assumeDirectory("./", workingDir.relativize(fixturesDir))
val importer = makeImporter(null, searchIn.invariantSeparatorsPathString) val importer = makeImporter(null, searchIn.invariantSeparatorsPathString)
val srcPath = Helpers.assumeReadableFile(Helpers.fixturesDir, "ast_file_with_syntax_error.p8") val srcPath = assumeReadableFile(fixturesDir, "ast_file_with_syntax_error.p8")
repeat(2) { n -> withClue(count[n] + " call") { repeat(2) { n -> withClue(count[n] + " call") {
shouldThrow<ParseError>() shouldThrow<ParseError>()
@ -241,10 +241,10 @@ class TestModuleImporter: FunSpec({
fun doTestImportingFileWithSyntaxError(repetitions: Int) { fun doTestImportingFileWithSyntaxError(repetitions: Int) {
val searchIn = Helpers.assumeDirectory("./", Helpers.workingDir.relativize(Helpers.fixturesDir)) val searchIn = assumeDirectory("./", workingDir.relativize(fixturesDir))
val importer = makeImporter(null, searchIn.invariantSeparatorsPathString) val importer = makeImporter(null, searchIn.invariantSeparatorsPathString)
val importing = Helpers.assumeReadableFile(Helpers.fixturesDir, "import_file_with_syntax_error.p8") val importing = assumeReadableFile(fixturesDir, "import_file_with_syntax_error.p8")
val imported = Helpers.assumeReadableFile(Helpers.fixturesDir, "file_with_syntax_error.p8") val imported = assumeReadableFile(fixturesDir, "file_with_syntax_error.p8")
val act = { importer.importLibraryModule(importing.nameWithoutExtension) } val act = { importer.importLibraryModule(importing.nameWithoutExtension) }

View File

@ -8,8 +8,10 @@ import prog8.code.target.Cx16Target
import prog8.compiler.CompilationResult import prog8.compiler.CompilationResult
import prog8.compiler.CompilerArguments import prog8.compiler.CompilerArguments
import prog8.compiler.compileProgram import prog8.compiler.compileProgram
import prog8tests.helpers.Combinations import prog8tests.helpers.assumeDirectory
import prog8tests.helpers.Helpers import prog8tests.helpers.cartesianProduct
import prog8tests.helpers.outputDir
import prog8tests.helpers.workingDir
import java.nio.file.Path import java.nio.file.Path
import kotlin.io.path.absolute import kotlin.io.path.absolute
import kotlin.io.path.exists import kotlin.io.path.exists
@ -21,7 +23,7 @@ import kotlin.io.path.exists
* from source file loading all the way through to running 64tass. * from source file loading all the way through to running 64tass.
*/ */
private val examplesDir = Helpers.assumeDirectory(Helpers.workingDir, "../examples") private val examplesDir = assumeDirectory(workingDir, "../examples")
private fun compileTheThing(filepath: Path, optimize: Boolean, target: ICompilationTarget): CompilationResult? { private fun compileTheThing(filepath: Path, optimize: Boolean, target: ICompilationTarget): CompilationResult? {
val args = CompilerArguments( val args = CompilerArguments(
@ -35,7 +37,7 @@ private fun compileTheThing(filepath: Path, optimize: Boolean, target: ICompilat
asmListfile = false, asmListfile = false,
experimentalCodegen = false, experimentalCodegen = false,
compilationTarget = target.name, compilationTarget = target.name,
outputDir = Helpers.outputDir outputDir = outputDir
) )
return compileProgram(args) return compileProgram(args)
} }
@ -43,12 +45,12 @@ private fun compileTheThing(filepath: Path, optimize: Boolean, target: ICompilat
private fun prepareTestFiles(source: String, optimize: Boolean, target: ICompilationTarget): Pair<String, Path> { private fun prepareTestFiles(source: String, optimize: Boolean, target: ICompilationTarget): Pair<String, Path> {
val searchIn = mutableListOf(examplesDir) val searchIn = mutableListOf(examplesDir)
if (target is Cx16Target) { if (target is Cx16Target) {
searchIn.add(0, Helpers.assumeDirectory(examplesDir, "cx16")) searchIn.add(0, assumeDirectory(examplesDir, "cx16"))
} }
val filepath = searchIn.asSequence() val filepath = searchIn.asSequence()
.map { it.resolve("$source.p8") } .map { it.resolve("$source.p8") }
.map { it.normalize().absolute() } .map { it.normalize().absolute() }
.map { Helpers.workingDir.relativize(it) } .map { workingDir.relativize(it) }
.first { it.exists() } .first { it.exists() }
val displayName = "${examplesDir.relativize(filepath.absolute())}: ${target.name}, optimize=$optimize" val displayName = "${examplesDir.relativize(filepath.absolute())}: ${target.name}, optimize=$optimize"
return Pair(displayName, filepath) return Pair(displayName, filepath)
@ -57,7 +59,7 @@ private fun prepareTestFiles(source: String, optimize: Boolean, target: ICompila
class TestCompilerOnExamplesC64: FunSpec({ class TestCompilerOnExamplesC64: FunSpec({
val onlyC64 = Combinations.cartesianProduct( val onlyC64 = cartesianProduct(
listOf( listOf(
"balloonflight", "balloonflight",
"bdmusic", "bdmusic",
@ -84,7 +86,7 @@ class TestCompilerOnExamplesC64: FunSpec({
class TestCompilerOnExamplesCx16: FunSpec({ class TestCompilerOnExamplesCx16: FunSpec({
val onlyCx16 = Combinations.cartesianProduct( val onlyCx16 = cartesianProduct(
listOf( listOf(
"vtui/testvtui", "vtui/testvtui",
"amiga", "amiga",
@ -116,7 +118,7 @@ class TestCompilerOnExamplesCx16: FunSpec({
class TestCompilerOnExamplesBothC64andCx16: FunSpec({ class TestCompilerOnExamplesBothC64andCx16: FunSpec({
val bothCx16AndC64 = Combinations.cartesianProduct( val bothCx16AndC64 = cartesianProduct(
listOf( listOf(
"animals", "animals",
"balls", "balls",

View File

@ -10,7 +10,7 @@ import prog8.ast.expressions.StringLiteral
import prog8.ast.statements.FunctionCallStatement import prog8.ast.statements.FunctionCallStatement
import prog8.ast.statements.Label import prog8.ast.statements.Label
import prog8.code.target.Cx16Target import prog8.code.target.Cx16Target
import prog8tests.helpers.Helpers import prog8tests.helpers.*
import prog8tests.helpers.compileFile import prog8tests.helpers.compileFile
import kotlin.io.path.name import kotlin.io.path.name
@ -25,11 +25,11 @@ class TestCompilerOnImportsAndIncludes: FunSpec({
context("Import") { context("Import") {
test("testImportFromSameFolder") { test("testImportFromSameFolder") {
val filepath = Helpers.assumeReadableFile(Helpers.fixturesDir, "importFromSameFolder.p8") val filepath = assumeReadableFile(fixturesDir, "importFromSameFolder.p8")
Helpers.assumeReadableFile(Helpers.fixturesDir, "foo_bar.p8") assumeReadableFile(fixturesDir, "foo_bar.p8")
val platform = Cx16Target() val platform = Cx16Target()
val result = compileFile(platform, optimize = false, Helpers.fixturesDir, filepath.name)!! val result = compileFile(platform, optimize = false, fixturesDir, filepath.name)!!
val program = result.program val program = result.program
val startSub = program.entrypoint val startSub = program.entrypoint
@ -47,11 +47,11 @@ class TestCompilerOnImportsAndIncludes: FunSpec({
context("AsmInclude") { context("AsmInclude") {
test("testAsmIncludeFromSameFolder") { test("testAsmIncludeFromSameFolder") {
val filepath = Helpers.assumeReadableFile(Helpers.fixturesDir, "asmIncludeFromSameFolder.p8") val filepath = assumeReadableFile(fixturesDir, "asmIncludeFromSameFolder.p8")
Helpers.assumeReadableFile(Helpers.fixturesDir, "foo_bar.asm") assumeReadableFile(fixturesDir, "foo_bar.asm")
val platform = Cx16Target() val platform = Cx16Target()
val result = compileFile(platform, optimize = false, Helpers.fixturesDir, filepath.name)!! val result = compileFile(platform, optimize = false, fixturesDir, filepath.name)!!
val program = result.program val program = result.program
val startSub = program.entrypoint val startSub = program.entrypoint
@ -72,17 +72,17 @@ class TestCompilerOnImportsAndIncludes: FunSpec({
context("Asmbinary") { context("Asmbinary") {
test("testAsmbinaryDirectiveWithNonExistingFile") { test("testAsmbinaryDirectiveWithNonExistingFile") {
val p8Path = Helpers.assumeReadableFile(Helpers.fixturesDir, "asmBinaryNonExisting.p8") val p8Path = assumeReadableFile(fixturesDir, "asmBinaryNonExisting.p8")
Helpers.assumeNotExists(Helpers.fixturesDir, "i_do_not_exist.bin") assumeNotExists(fixturesDir, "i_do_not_exist.bin")
compileFile(Cx16Target(), false, p8Path.parent, p8Path.name, Helpers.outputDir) shouldBe null compileFile(Cx16Target(), false, p8Path.parent, p8Path.name, outputDir) shouldBe null
} }
test("testAsmbinaryDirectiveWithNonReadableFile") { test("testAsmbinaryDirectiveWithNonReadableFile") {
val p8Path = Helpers.assumeReadableFile(Helpers.fixturesDir, "asmBinaryNonReadable.p8") val p8Path = assumeReadableFile(fixturesDir, "asmBinaryNonReadable.p8")
Helpers.assumeDirectory(Helpers.fixturesDir, "subFolder") assumeDirectory(fixturesDir, "subFolder")
compileFile(Cx16Target(), false, p8Path.parent, p8Path.name, Helpers.outputDir) shouldBe null compileFile(Cx16Target(), false, p8Path.parent, p8Path.name, outputDir) shouldBe null
} }
val tests = listOf( val tests = listOf(
@ -93,18 +93,18 @@ class TestCompilerOnImportsAndIncludes: FunSpec({
tests.forEach { tests.forEach {
val (where, p8Str, _) = it val (where, p8Str, _) = it
test("%asmbinary from ${where}folder") { test("%asmbinary from ${where}folder") {
val p8Path = Helpers.assumeReadableFile(Helpers.fixturesDir, p8Str) val p8Path = assumeReadableFile(fixturesDir, p8Str)
// val binPath = Helpers.assumeReadableFile(Helpers.fixturesDir, binStr) // val binPath = assumeReadableFile(fixturesDir, binStr)
// the bug we're testing for (#54) was hidden if outputDir == workingDir // the bug we're testing for (#54) was hidden if outputDir == workingDir
withClue("sanity check: workingDir and outputDir should not be the same folder") { withClue("sanity check: workingDir and outputDir should not be the same folder") {
Helpers.outputDir.normalize().toAbsolutePath() shouldNotBe Helpers.workingDir.normalize().toAbsolutePath() outputDir.normalize().toAbsolutePath() shouldNotBe workingDir.normalize().toAbsolutePath()
} }
withClue("argument to assembler directive .binary " + withClue("argument to assembler directive .binary " +
"should be relative to the generated .asm file (in output dir), " + "should be relative to the generated .asm file (in output dir), " +
"NOT relative to .p8 neither current working dir") { "NOT relative to .p8 neither current working dir") {
compileFile(Cx16Target(), false, p8Path.parent, p8Path.name, Helpers.outputDir) shouldNotBe null compileFile(Cx16Target(), false, p8Path.parent, p8Path.name, outputDir) shouldNotBe null
} }
} }
} }

View File

@ -17,9 +17,9 @@ import prog8.code.core.Encoding
import prog8.code.core.Position import prog8.code.core.Position
import prog8.code.target.C64Target import prog8.code.target.C64Target
import prog8.code.target.Cx16Target import prog8.code.target.Cx16Target
import prog8tests.helpers.Combinations
import prog8tests.helpers.ErrorReporterForTests import prog8tests.helpers.ErrorReporterForTests
import prog8tests.helpers.compileText import prog8tests.helpers.compileText
import prog8tests.helpers.cartesianProduct
/** /**
@ -93,7 +93,7 @@ class TestCompilerOnRanges: FunSpec({
} }
context("floatArrayInitializerWithRange") { context("floatArrayInitializerWithRange") {
val combos = Combinations.cartesianProduct( val combos = cartesianProduct(
listOf("", "42", "41"), // sizeInDecl listOf("", "42", "41"), // sizeInDecl
listOf("%import floats", ""), // optEnableFloats listOf("%import floats", ""), // optEnableFloats
listOf(Cx16Target(), C64Target()), // platform listOf(Cx16Target(), C64Target()), // platform

View File

@ -6,7 +6,10 @@ import prog8.code.target.Cx16Target
import prog8.compiler.CompilationResult import prog8.compiler.CompilationResult
import prog8.compiler.CompilerArguments import prog8.compiler.CompilerArguments
import prog8.compiler.compileProgram import prog8.compiler.compileProgram
import prog8tests.helpers.Helpers import prog8tests.helpers.assumeReadableFile
import prog8tests.helpers.fixturesDir
import prog8tests.helpers.outputDir
import prog8tests.helpers.workingDir
import java.nio.file.Path import java.nio.file.Path
import kotlin.io.path.absolute import kotlin.io.path.absolute
import kotlin.io.path.createTempFile import kotlin.io.path.createTempFile
@ -23,7 +26,7 @@ class TestCompilerOptionSourcedirs: FunSpec({
lateinit var tempFileInWorkingDir: Path lateinit var tempFileInWorkingDir: Path
beforeSpec { beforeSpec {
tempFileInWorkingDir = createTempFile(directory = Helpers.workingDir, prefix = "tmp_", suffix = ".p8") tempFileInWorkingDir = createTempFile(directory = workingDir, prefix = "tmp_", suffix = ".p8")
.also { it.writeText(""" .also { it.writeText("""
main { main {
sub start() { sub start() {
@ -49,39 +52,39 @@ class TestCompilerOptionSourcedirs: FunSpec({
experimentalCodegen = false, experimentalCodegen = false,
compilationTarget = Cx16Target.NAME, compilationTarget = Cx16Target.NAME,
sourceDirs, sourceDirs,
Helpers.outputDir outputDir
) )
return compileProgram(args) return compileProgram(args)
} }
test("testAbsoluteFilePathInWorkingDir") { test("testAbsoluteFilePathInWorkingDir") {
val filepath = Helpers.assumeReadableFile(tempFileInWorkingDir.absolute()) val filepath = assumeReadableFile(tempFileInWorkingDir.absolute())
compileFile(filepath, listOf()) shouldNotBe null compileFile(filepath, listOf()) shouldNotBe null
} }
test("testFilePathInWorkingDirRelativeToWorkingDir") { test("testFilePathInWorkingDirRelativeToWorkingDir") {
val filepath = Helpers.assumeReadableFile(Helpers.workingDir.relativize(tempFileInWorkingDir.absolute())) val filepath = assumeReadableFile(workingDir.relativize(tempFileInWorkingDir.absolute()))
compileFile(filepath, listOf()) shouldNotBe null compileFile(filepath, listOf()) shouldNotBe null
} }
test("testFilePathInWorkingDirRelativeTo1stInSourcedirs") { test("testFilePathInWorkingDirRelativeTo1stInSourcedirs") {
val filepath = Helpers.assumeReadableFile(tempFileInWorkingDir) val filepath = assumeReadableFile(tempFileInWorkingDir)
compileFile(filepath.fileName, listOf(Helpers.workingDir.toString())) shouldNotBe null compileFile(filepath.fileName, listOf(workingDir.toString())) shouldNotBe null
} }
test("testAbsoluteFilePathOutsideWorkingDir") { test("testAbsoluteFilePathOutsideWorkingDir") {
val filepath = Helpers.assumeReadableFile(Helpers.fixturesDir, "ast_simple_main.p8") val filepath = assumeReadableFile(fixturesDir, "ast_simple_main.p8")
compileFile(filepath.absolute(), listOf()) shouldNotBe null compileFile(filepath.absolute(), listOf()) shouldNotBe null
} }
test("testFilePathOutsideWorkingDirRelativeToWorkingDir") { test("testFilePathOutsideWorkingDirRelativeToWorkingDir") {
val filepath = Helpers.workingDir.relativize(Helpers.assumeReadableFile(Helpers.fixturesDir, "ast_simple_main.p8").absolute()) val filepath = workingDir.relativize(assumeReadableFile(fixturesDir, "ast_simple_main.p8").absolute())
compileFile(filepath, listOf()) shouldNotBe null compileFile(filepath, listOf()) shouldNotBe null
} }
test("testFilePathOutsideWorkingDirRelativeTo1stInSourcedirs") { test("testFilePathOutsideWorkingDirRelativeTo1stInSourcedirs") {
val filepath = Helpers.assumeReadableFile(Helpers.fixturesDir, "ast_simple_main.p8") val filepath = assumeReadableFile(fixturesDir, "ast_simple_main.p8")
val sourcedirs = listOf("${Helpers.fixturesDir}") val sourcedirs = listOf("${fixturesDir}")
compileFile(filepath.fileName, sourcedirs) shouldNotBe null compileFile(filepath.fileName, sourcedirs) shouldNotBe null
} }

View File

@ -10,8 +10,8 @@ import prog8.code.target.C64Target
import prog8.compiler.determineCompilationOptions import prog8.compiler.determineCompilationOptions
import prog8.compiler.parseImports import prog8.compiler.parseImports
import prog8tests.helpers.ErrorReporterForTests import prog8tests.helpers.ErrorReporterForTests
import prog8tests.helpers.Helpers
import prog8tests.helpers.compileText import prog8tests.helpers.compileText
import prog8tests.helpers.outputDir
class TestImportedModulesOrderAndOptions: FunSpec({ class TestImportedModulesOrderAndOptions: FunSpec({
@ -85,7 +85,7 @@ main {
} }
""" """
val filenameBase = "on_the_fly_test_" + sourceText.hashCode().toUInt().toString(16) val filenameBase = "on_the_fly_test_" + sourceText.hashCode().toUInt().toString(16)
val filepath = Helpers.outputDir.resolve("$filenameBase.p8") val filepath = outputDir.resolve("$filenameBase.p8")
filepath.toFile().writeText(sourceText) filepath.toFile().writeText(sourceText)
val (program, options, importedfiles) = parseImports(filepath, errors, C64Target(), emptyList()) val (program, options, importedfiles) = parseImports(filepath, errors, C64Target(), emptyList())

View File

@ -299,7 +299,7 @@ class TestOptimization: FunSpec({
floats = false, floats = false,
noSysInit = true, noSysInit = true,
compTarget = C64Target(), compTarget = C64Target(),
loadAddress = 0u, outputDir= Helpers.outputDir) loadAddress = 0u, outputDir= outputDir)
result.program.processAstBeforeAsmGeneration(options, ErrorReporterForTests()) result.program.processAstBeforeAsmGeneration(options, ErrorReporterForTests())
// assignment is now split into: // assignment is now split into:

View File

@ -23,6 +23,8 @@ import prog8.code.target.cbm.PetsciiEncoding
import prog8.parser.ParseError import prog8.parser.ParseError
import prog8.parser.Prog8Parser.parseModule import prog8.parser.Prog8Parser.parseModule
import prog8tests.helpers.* import prog8tests.helpers.*
import prog8tests.helpers.DummyFunctions
import prog8tests.helpers.DummyMemsizer
import kotlin.io.path.Path import kotlin.io.path.Path
import kotlin.io.path.isRegularFile import kotlin.io.path.isRegularFile
import kotlin.io.path.name import kotlin.io.path.name
@ -173,8 +175,8 @@ class TestProg8Parser: FunSpec( {
context("ImportDirectives") { context("ImportDirectives") {
test("should not be looked into by the parser") { test("should not be looked into by the parser") {
val importedNoExt = Helpers.assumeNotExists(Helpers.fixturesDir, "i_do_not_exist") val importedNoExt = assumeNotExists(fixturesDir, "i_do_not_exist")
Helpers.assumeNotExists(Helpers.fixturesDir, "i_do_not_exist.p8") assumeNotExists(fixturesDir, "i_do_not_exist.p8")
val text = "%import ${importedNoExt.name}" val text = "%import ${importedNoExt.name}"
val module = parseModule(SourceCode.Text(text)) val module = parseModule(SourceCode.Text(text))
@ -189,7 +191,7 @@ class TestProg8Parser: FunSpec( {
} }
test("from an empty file should result in empty Module") { test("from an empty file should result in empty Module") {
val path = Helpers.assumeReadableFile(Helpers.fixturesDir, "ast_empty.p8") val path = assumeReadableFile(fixturesDir, "ast_empty.p8")
val module = parseModule(SourceCode.File(path)) val module = parseModule(SourceCode.File(path))
module.statements.size shouldBe 0 module.statements.size shouldBe 0
} }
@ -208,7 +210,7 @@ class TestProg8Parser: FunSpec( {
} }
test("parsed from a file") { test("parsed from a file") {
val path = Helpers.assumeReadableFile(Helpers.fixturesDir, "ast_simple_main.p8") val path = assumeReadableFile(fixturesDir, "ast_simple_main.p8")
val module = parseModule(SourceCode.File(path)) val module = parseModule(SourceCode.File(path))
module.name shouldBe path.nameWithoutExtension module.name shouldBe path.nameWithoutExtension
} }
@ -271,7 +273,7 @@ class TestProg8Parser: FunSpec( {
} }
test("in ParseError from bad file source code") { test("in ParseError from bad file source code") {
val path = Helpers.assumeReadableFile(Helpers.fixturesDir, "ast_file_with_syntax_error.p8") val path = assumeReadableFile(fixturesDir, "ast_file_with_syntax_error.p8")
val e = shouldThrow<ParseError> { parseModule(SourceCode.File(path)) } val e = shouldThrow<ParseError> { parseModule(SourceCode.File(path)) }
assertPosition(e.position, SourceCode.relative(path).toString(), 2, 6) assertPosition(e.position, SourceCode.relative(path).toString(), 2, 6)
@ -287,13 +289,13 @@ class TestProg8Parser: FunSpec( {
} }
test("of Module parsed from a file") { test("of Module parsed from a file") {
val path = Helpers.assumeReadableFile(Helpers.fixturesDir, "ast_simple_main.p8") val path = assumeReadableFile(fixturesDir, "ast_simple_main.p8")
val module = parseModule(SourceCode.File(path)) val module = parseModule(SourceCode.File(path))
assertPositionOf(module, SourceCode.relative(path).toString(), 1, 0) assertPositionOf(module, SourceCode.relative(path).toString(), 1, 0)
} }
test("of non-root Nodes parsed from file") { test("of non-root Nodes parsed from file") {
val path = Helpers.assumeReadableFile(Helpers.fixturesDir, "ast_simple_main.p8") val path = assumeReadableFile(fixturesDir, "ast_simple_main.p8")
val module = parseModule(SourceCode.File(path)) val module = parseModule(SourceCode.File(path))
val mpf = module.position.file val mpf = module.position.file
@ -357,7 +359,7 @@ class TestProg8Parser: FunSpec( {
} }
test("isn't absolute for filesystem paths") { test("isn't absolute for filesystem paths") {
val path = Helpers.assumeReadableFile(Helpers.fixturesDir, "ast_simple_main.p8") val path = assumeReadableFile(fixturesDir, "ast_simple_main.p8")
val module = parseModule(SourceCode.File(path)) val module = parseModule(SourceCode.File(path))
assertSomethingForAllNodes(module) { assertSomethingForAllNodes(module) {
Path(it.position.file).isAbsolute shouldBe false Path(it.position.file).isAbsolute shouldBe false

View File

@ -6,7 +6,10 @@ import io.kotest.matchers.shouldBe
import io.kotest.matchers.string.shouldContain import io.kotest.matchers.string.shouldContain
import prog8.code.core.SourceCode import prog8.code.core.SourceCode
import prog8.code.core.SourceCode.Companion.libraryFilePrefix import prog8.code.core.SourceCode.Companion.libraryFilePrefix
import prog8tests.helpers.Helpers import prog8tests.helpers.assumeNotExists
import prog8tests.helpers.assumeReadableFile
import prog8tests.helpers.fixturesDir
import prog8tests.helpers.resourcesDir
import kotlin.io.path.Path import kotlin.io.path.Path
@ -29,26 +32,26 @@ class TestSourceCode: AnnotationSpec() {
@Test @Test
fun testFromPathWithNonExistingPath() { fun testFromPathWithNonExistingPath() {
val filename = "i_do_not_exist.p8" val filename = "i_do_not_exist.p8"
val path = Helpers.assumeNotExists(Helpers.fixturesDir, filename) val path = assumeNotExists(fixturesDir, filename)
shouldThrow<NoSuchFileException> { SourceCode.File(path) } shouldThrow<NoSuchFileException> { SourceCode.File(path) }
} }
@Test @Test
fun testFromPathWithMissingExtension_p8() { fun testFromPathWithMissingExtension_p8() {
val pathWithoutExt = Helpers.assumeNotExists(Helpers.fixturesDir,"simple_main") val pathWithoutExt = assumeNotExists(fixturesDir,"simple_main")
Helpers.assumeReadableFile(Helpers.fixturesDir,"ast_simple_main.p8") assumeReadableFile(fixturesDir,"ast_simple_main.p8")
shouldThrow<NoSuchFileException> { SourceCode.File(pathWithoutExt) } shouldThrow<NoSuchFileException> { SourceCode.File(pathWithoutExt) }
} }
@Test @Test
fun testFromPathWithDirectory() { fun testFromPathWithDirectory() {
shouldThrow<FileSystemException> { SourceCode.File(Helpers.fixturesDir) } shouldThrow<FileSystemException> { SourceCode.File(fixturesDir) }
} }
@Test @Test
fun testFromPathWithExistingPath() { fun testFromPathWithExistingPath() {
val filename = "ast_simple_main.p8" val filename = "ast_simple_main.p8"
val path = Helpers.assumeReadableFile(Helpers.fixturesDir, filename) val path = assumeReadableFile(fixturesDir, filename)
val src = SourceCode.File(path) val src = SourceCode.File(path)
val expectedOrigin = SourceCode.relative(path).toString() val expectedOrigin = SourceCode.relative(path).toString()
src.origin shouldBe expectedOrigin src.origin shouldBe expectedOrigin
@ -61,7 +64,7 @@ class TestSourceCode: AnnotationSpec() {
fun testFromPathWithExistingNonNormalizedPath() { fun testFromPathWithExistingNonNormalizedPath() {
val filename = "ast_simple_main.p8" val filename = "ast_simple_main.p8"
val path = Path(".", "test", "..", "test", "fixtures", filename) val path = Path(".", "test", "..", "test", "fixtures", filename)
val srcFile = Helpers.assumeReadableFile(path).toFile() val srcFile = assumeReadableFile(path).toFile()
val src = SourceCode.File(path) val src = SourceCode.File(path)
val expectedOrigin = SourceCode.relative(path).toString() val expectedOrigin = SourceCode.relative(path).toString()
src.origin shouldBe expectedOrigin src.origin shouldBe expectedOrigin
@ -71,7 +74,7 @@ class TestSourceCode: AnnotationSpec() {
@Test @Test
fun testFromResourcesWithExistingP8File_withoutLeadingSlash() { fun testFromResourcesWithExistingP8File_withoutLeadingSlash() {
val pathString = "prog8lib/math.p8" val pathString = "prog8lib/math.p8"
val srcFile = Helpers.assumeReadableFile(Helpers.resourcesDir, pathString).toFile() val srcFile = assumeReadableFile(resourcesDir, pathString).toFile()
val src = SourceCode.Resource(pathString) val src = SourceCode.Resource(pathString)
src.origin shouldBe "$libraryFilePrefix/$pathString" src.origin shouldBe "$libraryFilePrefix/$pathString"
@ -83,7 +86,7 @@ class TestSourceCode: AnnotationSpec() {
@Test @Test
fun testFromResourcesWithExistingP8File_withLeadingSlash() { fun testFromResourcesWithExistingP8File_withLeadingSlash() {
val pathString = "/prog8lib/math.p8" val pathString = "/prog8lib/math.p8"
val srcFile = Helpers.assumeReadableFile(Helpers.resourcesDir, pathString.substring(1)).toFile() val srcFile = assumeReadableFile(resourcesDir, pathString.substring(1)).toFile()
val src = SourceCode.Resource(pathString) val src = SourceCode.Resource(pathString)
src.origin shouldBe "$libraryFilePrefix$pathString" src.origin shouldBe "$libraryFilePrefix$pathString"
@ -93,7 +96,7 @@ class TestSourceCode: AnnotationSpec() {
@Test @Test
fun testFromResourcesWithExistingAsmFile_withoutLeadingSlash() { fun testFromResourcesWithExistingAsmFile_withoutLeadingSlash() {
val pathString = "prog8lib/math.asm" val pathString = "prog8lib/math.asm"
val srcFile = Helpers.assumeReadableFile(Helpers.resourcesDir, pathString).toFile() val srcFile = assumeReadableFile(resourcesDir, pathString).toFile()
val src = SourceCode.Resource(pathString) val src = SourceCode.Resource(pathString)
src.origin shouldBe "$libraryFilePrefix/$pathString" src.origin shouldBe "$libraryFilePrefix/$pathString"
@ -104,7 +107,7 @@ class TestSourceCode: AnnotationSpec() {
@Test @Test
fun testFromResourcesWithExistingAsmFile_withLeadingSlash() { fun testFromResourcesWithExistingAsmFile_withLeadingSlash() {
val pathString = "/prog8lib/math.asm" val pathString = "/prog8lib/math.asm"
val srcFile = Helpers.assumeReadableFile(Helpers.resourcesDir, pathString.substring(1)).toFile() val srcFile = assumeReadableFile(resourcesDir, pathString.substring(1)).toFile()
val src = SourceCode.Resource(pathString) val src = SourceCode.Resource(pathString)
src.origin shouldBe "$libraryFilePrefix$pathString" src.origin shouldBe "$libraryFilePrefix$pathString"
@ -114,7 +117,7 @@ class TestSourceCode: AnnotationSpec() {
@Test @Test
fun testFromResourcesWithNonNormalizedPath() { fun testFromResourcesWithNonNormalizedPath() {
val pathString = "/prog8lib/../prog8lib/math.p8" val pathString = "/prog8lib/../prog8lib/math.p8"
val srcFile = Helpers.assumeReadableFile(Helpers.resourcesDir, pathString.substring(1)).toFile() val srcFile = assumeReadableFile(resourcesDir, pathString.substring(1)).toFile()
val src = SourceCode.Resource(pathString) val src = SourceCode.Resource(pathString)
src.origin shouldBe "$libraryFilePrefix/prog8lib/math.p8" src.origin shouldBe "$libraryFilePrefix/prog8lib/math.p8"
@ -126,14 +129,14 @@ class TestSourceCode: AnnotationSpec() {
@Test @Test
fun testFromResourcesWithNonExistingFile_withLeadingSlash() { fun testFromResourcesWithNonExistingFile_withLeadingSlash() {
val pathString = "/prog8lib/i_do_not_exist" val pathString = "/prog8lib/i_do_not_exist"
Helpers.assumeNotExists(Helpers.resourcesDir, pathString.substring(1)) assumeNotExists(resourcesDir, pathString.substring(1))
shouldThrow<NoSuchFileException> { SourceCode.Resource(pathString) } shouldThrow<NoSuchFileException> { SourceCode.Resource(pathString) }
} }
@Test @Test
fun testFromResourcesWithNonExistingFile_withoutLeadingSlash() { fun testFromResourcesWithNonExistingFile_withoutLeadingSlash() {
val pathString = "prog8lib/i_do_not_exist" val pathString = "prog8lib/i_do_not_exist"
Helpers.assumeNotExists(Helpers.resourcesDir, pathString) assumeNotExists(resourcesDir, pathString)
shouldThrow<NoSuchFileException> { SourceCode.Resource(pathString) } shouldThrow<NoSuchFileException> { SourceCode.Resource(pathString) }
} }

View File

@ -19,13 +19,13 @@ internal fun compileFile(
optimize: Boolean, optimize: Boolean,
fileDir: Path, fileDir: Path,
fileName: String, fileName: String,
outputDir: Path = prog8tests.helpers.Helpers.outputDir, outputDir: Path = prog8tests.helpers.outputDir,
errors: IErrorReporter? = null, errors: IErrorReporter? = null,
writeAssembly: Boolean = true, writeAssembly: Boolean = true,
optFloatExpr: Boolean = true optFloatExpr: Boolean = true
) : CompilationResult? { ) : CompilationResult? {
val filepath = fileDir.resolve(fileName) val filepath = fileDir.resolve(fileName)
Helpers.assumeReadableFile(filepath) assumeReadableFile(filepath)
val args = CompilerArguments( val args = CompilerArguments(
filepath, filepath,
optimize, optimize,
@ -56,7 +56,7 @@ internal fun compileText(
writeAssembly: Boolean = true, writeAssembly: Boolean = true,
optFloatExpr: Boolean = true optFloatExpr: Boolean = true
) : CompilationResult? { ) : CompilationResult? {
val filePath = Helpers.outputDir.resolve("on_the_fly_test_" + sourceText.hashCode().toUInt().toString(16) + ".p8") val filePath = outputDir.resolve("on_the_fly_test_" + sourceText.hashCode().toUInt().toString(16) + ".p8")
// we don't assumeNotExists(filePath) - should be ok to just overwrite it // we don't assumeNotExists(filePath) - should be ok to just overwrite it
filePath.toFile().writeText(sourceText) filePath.toFile().writeText(sourceText)
return compileFile(platform, optimize, filePath.parent, filePath.name, errors=errors, writeAssembly=writeAssembly, optFloatExpr = optFloatExpr) return compileFile(platform, optimize, filePath.parent, filePath.name, errors=errors, writeAssembly=writeAssembly, optFloatExpr = optFloatExpr)
@ -71,7 +71,7 @@ internal fun generateAssembly(
floats = true, floats = true,
noSysInit = true, noSysInit = true,
compTarget = C64Target(), compTarget = C64Target(),
loadAddress = 0u, outputDir = Helpers.outputDir) loadAddress = 0u, outputDir = outputDir)
coptions.compTarget.machine.zeropage = C64Zeropage(coptions) coptions.compTarget.machine.zeropage = C64Zeropage(coptions)
val st = SymbolTableMaker().makeFrom(program) val st = SymbolTableMaker().makeFrom(program)
val errors = ErrorReporterForTests() val errors = ErrorReporterForTests()

View File

@ -1,68 +1,66 @@
package prog8tests.helpers package prog8tests.helpers
object Combinations { fun <T, U> cartesianProduct(c1: Collection<T>, c2: Collection<U>): Sequence<Pair<T, U>> {
fun <T, U> cartesianProduct(c1: Collection<T>, c2: Collection<U>): Sequence<Pair<T, U>> { return c1.flatMap { lhsElem -> c2.map { rhsElem -> lhsElem to rhsElem } }.asSequence()
return c1.flatMap { lhsElem -> c2.map { rhsElem -> lhsElem to rhsElem } }.asSequence() }
fun <T, U, V> cartesianProduct(c1: Collection<T>, c2: Collection<U>, c3: Collection<V>): Sequence<Triple<T, U, V>> {
return sequence {
for (a in c1)
for (b in c2)
for (c in c3)
yield(Triple(a, b, c))
} }
}
fun <T, U, V> cartesianProduct(c1: Collection<T>, c2: Collection<U>, c3: Collection<V>): Sequence<Triple<T, U, V>> { data class Product<out T, out U, out V, out W>(val first: T, val second: U, val third: V, val fourth: W)
return sequence {
for (a in c1) fun <T, U, V, W> cartesianProduct(
for (b in c2) c1: Collection<T>,
for (c in c3) c2: Collection<U>,
yield(Triple(a, b, c)) c3: Collection<V>,
} c4: Collection<W>
): Sequence<Product<T, U, V, W>> {
return sequence {
for (a in c1)
for (b in c2)
for (c in c3)
for (d in c4)
yield(Product(a, b, c, d))
} }
}
data class Product<out T, out U, out V, out W>(val first: T, val second: U, val third: V, val fourth: W) fun <A, B, R> mapCombinations(dim1: Iterable<A>, dim2: Iterable<B>, combine2: (A, B) -> R) =
sequence {
for (a in dim1)
for (b in dim2)
yield(combine2(a, b))
}.toList()
fun <T, U, V, W> cartesianProduct( fun <A, B, C, R> mapCombinations(
c1: Collection<T>, dim1: Iterable<A>,
c2: Collection<U>, dim2: Iterable<B>,
c3: Collection<V>, dim3: Iterable<C>,
c4: Collection<W> combine3: (A, B, C) -> R
): Sequence<Product<T, U, V, W>> { ) =
return sequence { sequence {
for (a in c1) for (a in dim1)
for (b in c2) for (b in dim2)
for (c in c3) for (c in dim3)
for (d in c4) yield(combine3(a, b, c))
yield(Product(a, b, c, d)) }.toList()
}
}
fun <A, B, R> mapCombinations(dim1: Iterable<A>, dim2: Iterable<B>, combine2: (A, B) -> R) = fun <A, B, C, D, R> mapCombinations(
sequence { dim1: Iterable<A>,
for (a in dim1) dim2: Iterable<B>,
for (b in dim2) dim3: Iterable<C>,
yield(combine2(a, b)) dim4: Iterable<D>,
}.toList() combine4: (A, B, C, D) -> R
) =
fun <A, B, C, R> mapCombinations( sequence {
dim1: Iterable<A>, for (a in dim1)
dim2: Iterable<B>, for (b in dim2)
dim3: Iterable<C>, for (c in dim3)
combine3: (A, B, C) -> R for (d in dim4)
) = yield(combine4(a, b, c, d))
sequence { }.toList()
for (a in dim1)
for (b in dim2)
for (c in dim3)
yield(combine3(a, b, c))
}.toList()
fun <A, B, C, D, R> mapCombinations(
dim1: Iterable<A>,
dim2: Iterable<B>,
dim3: Iterable<C>,
dim4: Iterable<D>,
combine4: (A, B, C, D) -> R
) =
sequence {
for (a in dim1)
for (b in dim2)
for (c in dim3)
for (d in dim4)
yield(combine4(a, b, c, d))
}.toList()
}

View File

@ -7,69 +7,66 @@ import java.nio.file.Path
import kotlin.io.path.* import kotlin.io.path.*
object Helpers { val workingDir = assumeDirectory("").absolute() // Note: "." does NOT work..!
val workingDir = assumeDirectory("").absolute() // Note: "." does NOT work..! val fixturesDir = assumeDirectory(workingDir, "test/fixtures")
val fixturesDir = assumeDirectory(workingDir, "test/fixtures") val resourcesDir = assumeDirectory(workingDir, "res")
val resourcesDir = assumeDirectory(workingDir, "res") val outputDir: Path =
val outputDir: Path = createIfNotExists(workingDir, "build/tmp/test").also { assumeDirectory(workingDir, "build/tmp/test") }
createIfNotExists(workingDir, "build/tmp/test").also { assumeDirectory(workingDir, "build/tmp/test") }
fun createIfNotExists(workingDir: Path, path: String): Path { fun createIfNotExists(workingDir: Path, path: String): Path {
val dir = workingDir / path val dir = workingDir / path
if (!dir.toFile().isDirectory) if (!dir.toFile().isDirectory)
Files.createDirectories(dir) Files.createDirectories(dir)
return dir return dir
}
fun assumeNotExists(path: Path): Path {
withClue("sanity check: should not exist: ${path.absolute()}") {
path.exists() shouldBe false
} }
return path
}
fun assumeNotExists(path: Path): Path { fun assumeNotExists(pathStr: String): Path = assumeNotExists(Path(pathStr))
withClue("sanity check: should not exist: ${path.absolute()}") { fun assumeNotExists(path: Path, other: String): Path = assumeNotExists(path / other)
path.exists() shouldBe false
} fun assumeReadable(path: Path): Path {
return path withClue("sanity check: should be readable: ${path.absolute()}") {
path.isReadable() shouldBe true
} }
return path
}
fun assumeNotExists(pathStr: String): Path = assumeNotExists(Path(pathStr)) fun assumeReadableFile(path: Path): Path {
fun assumeNotExists(path: Path, other: String): Path = assumeNotExists(path / other) withClue("sanity check: should be normal file: ${path.absolute()}") {
path.isRegularFile() shouldBe true
fun assumeReadable(path: Path): Path {
withClue("sanity check: should be readable: ${path.absolute()}") {
path.isReadable() shouldBe true
}
return path
} }
return assumeReadable(path)
}
fun assumeReadableFile(path: Path): Path { fun assumeReadableFile(pathStr: String): Path = assumeReadableFile(Path(pathStr))
withClue("sanity check: should be normal file: ${path.absolute()}") { fun assumeReadableFile(pathStr: String, other: Path): Path = assumeReadableFile(Path(pathStr), other)
path.isRegularFile() shouldBe true fun assumeReadableFile(pathStr: String, other: String): Path = assumeReadableFile(Path(pathStr), other)
} fun assumeReadableFile(path: Path, other: String): Path = assumeReadableFile(path / other)
return assumeReadable(path) fun assumeReadableFile(path: Path, other: Path): Path = assumeReadableFile(path / other)
fun assumeDirectory(path: Path): Path {
withClue("sanity check; should be directory: $path") {
path.isDirectory() shouldBe true
} }
return path
}
fun assumeReadableFile(pathStr: String): Path = assumeReadableFile(Path(pathStr)) fun assumeDirectory(pathStr: String): Path = assumeDirectory(Path(pathStr))
fun assumeReadableFile(pathStr: String, other: Path): Path = assumeReadableFile(Path(pathStr), other) fun assumeDirectory(path: Path, other: String): Path = assumeDirectory(path / other)
fun assumeReadableFile(pathStr: String, other: String): Path = assumeReadableFile(Path(pathStr), other) fun assumeDirectory(pathStr: String, other: String): Path = assumeDirectory(Path(pathStr) / other)
fun assumeReadableFile(path: Path, other: String): Path = assumeReadableFile(path / other) fun assumeDirectory(pathStr: String, other: Path): Path = assumeDirectory(Path(pathStr) / other)
fun assumeReadableFile(path: Path, other: Path): Path = assumeReadableFile(path / other)
fun assumeDirectory(path: Path): Path {
withClue("sanity check; should be directory: $path") {
path.isDirectory() shouldBe true
}
return path
}
fun assumeDirectory(pathStr: String): Path = assumeDirectory(Path(pathStr))
fun assumeDirectory(path: Path, other: String): Path = assumeDirectory(path / other)
fun assumeDirectory(pathStr: String, other: String): Path = assumeDirectory(Path(pathStr) / other)
fun assumeDirectory(pathStr: String, other: Path): Path = assumeDirectory(Path(pathStr) / other)
@Deprecated( @Deprecated(
"Directories are checked automatically at init.", "Directories are checked automatically at init.",
ReplaceWith("/* nothing */") ReplaceWith("/* nothing */")
) )
@Suppress("UNUSED_PARAMETER") @Suppress("UNUSED_PARAMETER")
fun sanityCheckDirectories(workingDirName: String? = null) { fun sanityCheckDirectories(workingDirName: String? = null) {
} }
}

View File

@ -4,7 +4,7 @@ import io.kotest.assertions.throwables.shouldThrow
import io.kotest.assertions.withClue import io.kotest.assertions.withClue
import io.kotest.core.spec.style.FunSpec import io.kotest.core.spec.style.FunSpec
import io.kotest.matchers.shouldBe import io.kotest.matchers.shouldBe
import prog8tests.helpers.Helpers import prog8tests.helpers.*
import kotlin.io.path.Path import kotlin.io.path.Path
import kotlin.io.path.div import kotlin.io.path.div
@ -20,21 +20,21 @@ class PathsHelpersTests: FunSpec({
context("WithOnePathArg") { context("WithOnePathArg") {
test("on non-existing path") { test("on non-existing path") {
val path = Helpers.fixturesDir / "i_do_not_exist" val path = fixturesDir / "i_do_not_exist"
withClue("should return the path") { withClue("should return the path") {
Helpers.assumeNotExists(path) shouldBe path assumeNotExists(path) shouldBe path
} }
} }
test("on existing file") { test("on existing file") {
shouldThrow<java.lang.AssertionError> { shouldThrow<java.lang.AssertionError> {
Helpers.assumeNotExists(Helpers.fixturesDir / "ast_simple_main.p8") assumeNotExists(fixturesDir / "ast_simple_main.p8")
} }
} }
test("on existing directory") { test("on existing directory") {
shouldThrow<java.lang.AssertionError> { shouldThrow<java.lang.AssertionError> {
Helpers.assumeNotExists(Helpers.fixturesDir) assumeNotExists(fixturesDir)
} }
} }
} }
@ -42,22 +42,22 @@ class PathsHelpersTests: FunSpec({
context("WithOneStringArg") { context("WithOneStringArg") {
test("on non-existing path") { test("on non-existing path") {
val path = Helpers.fixturesDir / "i_do_not_exist" val path = fixturesDir / "i_do_not_exist"
withClue("should return the path") { withClue("should return the path") {
Helpers.assumeNotExists("$path") shouldBe path assumeNotExists("$path") shouldBe path
} }
} }
test("on existing file") { test("on existing file") {
val path = Helpers.fixturesDir / "ast_simple_main.p8" val path = fixturesDir / "ast_simple_main.p8"
shouldThrow<java.lang.AssertionError> { shouldThrow<java.lang.AssertionError> {
Helpers.assumeNotExists("$path") assumeNotExists("$path")
} }
} }
test("on existing directory") { test("on existing directory") {
shouldThrow<java.lang.AssertionError> { shouldThrow<java.lang.AssertionError> {
Helpers.assumeNotExists("${Helpers.fixturesDir}") assumeNotExists("${fixturesDir}")
} }
} }
} }
@ -65,21 +65,21 @@ class PathsHelpersTests: FunSpec({
context("WithPathAndStringArgs") { context("WithPathAndStringArgs") {
test("on non-existing path") { test("on non-existing path") {
val path = Helpers.fixturesDir / "i_do_not_exist" val path = fixturesDir / "i_do_not_exist"
withClue("should return the path") { withClue("should return the path") {
Helpers.assumeNotExists(Helpers.fixturesDir / "i_do_not_exist") shouldBe path assumeNotExists(fixturesDir / "i_do_not_exist") shouldBe path
} }
} }
test("on existing file") { test("on existing file") {
shouldThrow<java.lang.AssertionError> { shouldThrow<java.lang.AssertionError> {
Helpers.assumeNotExists(Helpers.fixturesDir, "ast_simple_main.p8") assumeNotExists(fixturesDir, "ast_simple_main.p8")
} }
} }
test("on existing directory") { test("on existing directory") {
shouldThrow<java.lang.AssertionError> { shouldThrow<java.lang.AssertionError> {
Helpers.assumeNotExists(Helpers.fixturesDir, "..") assumeNotExists(fixturesDir, "..")
} }
} }
} }
@ -89,46 +89,46 @@ class PathsHelpersTests: FunSpec({
context("WithOnePathArg") { context("WithOnePathArg") {
test("on non-existing path") { test("on non-existing path") {
val path = Helpers.fixturesDir / "i_do_not_exist" val path = fixturesDir / "i_do_not_exist"
shouldThrow<AssertionError> { shouldThrow<AssertionError> {
Helpers.assumeDirectory(path) assumeDirectory(path)
} }
} }
test("on existing file") { test("on existing file") {
val path = Helpers.fixturesDir / "ast_simple_main.p8" val path = fixturesDir / "ast_simple_main.p8"
shouldThrow<AssertionError> { shouldThrow<AssertionError> {
Helpers.assumeDirectory(path) assumeDirectory(path)
} }
} }
test("on existing directory") { test("on existing directory") {
val path = Helpers.workingDir val path = workingDir
withClue("should return the path") { withClue("should return the path") {
Helpers.assumeDirectory(path) shouldBe path assumeDirectory(path) shouldBe path
} }
} }
} }
context("WithOneStringArg") { context("WithOneStringArg") {
test("on non-existing path") { test("on non-existing path") {
val path = Helpers.fixturesDir / "i_do_not_exist" val path = fixturesDir / "i_do_not_exist"
shouldThrow<AssertionError> { shouldThrow<AssertionError> {
Helpers.assumeDirectory("$path") assumeDirectory("$path")
} }
} }
test("on existing file") { test("on existing file") {
val path = Helpers.fixturesDir / "ast_simple_main.p8" val path = fixturesDir / "ast_simple_main.p8"
shouldThrow<AssertionError> { shouldThrow<AssertionError> {
Helpers.assumeDirectory("$path") assumeDirectory("$path")
} }
} }
test("on existing directory") { test("on existing directory") {
val path = Helpers.workingDir val path = workingDir
withClue("should return the path") { withClue("should return the path") {
Helpers.assumeDirectory("$path") shouldBe path assumeDirectory("$path") shouldBe path
} }
} }
} }
@ -136,20 +136,20 @@ class PathsHelpersTests: FunSpec({
context("WithPathAndStringArgs") { context("WithPathAndStringArgs") {
test("on non-existing path") { test("on non-existing path") {
shouldThrow<AssertionError> { shouldThrow<AssertionError> {
Helpers.assumeDirectory(Helpers.fixturesDir, "i_do_not_exist") assumeDirectory(fixturesDir, "i_do_not_exist")
} }
} }
test("on existing file") { test("on existing file") {
shouldThrow<AssertionError> { shouldThrow<AssertionError> {
Helpers.assumeDirectory(Helpers.fixturesDir, "ast_simple_main.p8") assumeDirectory(fixturesDir, "ast_simple_main.p8")
} }
} }
test("on existing directory") { test("on existing directory") {
val path = Helpers.workingDir / ".." val path = workingDir / ".."
withClue("should return resulting path") { withClue("should return resulting path") {
Helpers.assumeDirectory(Helpers.workingDir / "..") shouldBe path assumeDirectory(workingDir / "..") shouldBe path
} }
} }
} }
@ -157,20 +157,20 @@ class PathsHelpersTests: FunSpec({
context("WithStringAndStringArgs") { context("WithStringAndStringArgs") {
test("on non-existing path") { test("on non-existing path") {
shouldThrow<AssertionError> { shouldThrow<AssertionError> {
Helpers.assumeDirectory("${Helpers.fixturesDir}", "i_do_not_exist") assumeDirectory("${fixturesDir}", "i_do_not_exist")
} }
} }
test("on existing file") { test("on existing file") {
shouldThrow<AssertionError> { shouldThrow<AssertionError> {
Helpers.assumeDirectory("${Helpers.fixturesDir}", "ast_simple_main.p8") assumeDirectory("${fixturesDir}", "ast_simple_main.p8")
} }
} }
test("on existing directory") { test("on existing directory") {
val path = Helpers.workingDir / ".." val path = workingDir / ".."
withClue("should return resulting path") { withClue("should return resulting path") {
Helpers.assumeDirectory(Helpers.workingDir / "..") shouldBe path assumeDirectory(workingDir / "..") shouldBe path
} }
} }
} }
@ -178,20 +178,20 @@ class PathsHelpersTests: FunSpec({
context("WithStringAndPathArgs") { context("WithStringAndPathArgs") {
test("on non-existing path") { test("on non-existing path") {
shouldThrow<AssertionError> { shouldThrow<AssertionError> {
Helpers.assumeDirectory("${Helpers.fixturesDir}", Path("i_do_not_exist")) assumeDirectory("${fixturesDir}", Path("i_do_not_exist"))
} }
} }
test("on existing file") { test("on existing file") {
shouldThrow<AssertionError> { shouldThrow<AssertionError> {
Helpers.assumeDirectory("${Helpers.fixturesDir}", Path("ast_simple_main.p8")) assumeDirectory("${fixturesDir}", Path("ast_simple_main.p8"))
} }
} }
test("on existing directory") { test("on existing directory") {
val path = Helpers.workingDir / ".." val path = workingDir / ".."
withClue("should return resulting path") { withClue("should return resulting path") {
Helpers.assumeDirectory(Helpers.workingDir / Path("..")) shouldBe path assumeDirectory(workingDir / Path("..")) shouldBe path
} }
} }
} }
@ -202,22 +202,22 @@ class PathsHelpersTests: FunSpec({
context("WithOnePathArg") { context("WithOnePathArg") {
test("on non-existing path") { test("on non-existing path") {
val path = Helpers.fixturesDir / "i_do_not_exist" val path = fixturesDir / "i_do_not_exist"
shouldThrow<AssertionError> { shouldThrow<AssertionError> {
Helpers.assumeReadableFile(path) assumeReadableFile(path)
} }
} }
test("on readable file") { test("on readable file") {
val path = Helpers.fixturesDir / "ast_simple_main.p8" val path = fixturesDir / "ast_simple_main.p8"
withClue("should return the path") { withClue("should return the path") {
Helpers.assumeReadableFile(path) shouldBe path assumeReadableFile(path) shouldBe path
} }
} }
test("on directory") { test("on directory") {
shouldThrow<AssertionError> { shouldThrow<AssertionError> {
Helpers.assumeReadableFile(Helpers.fixturesDir) assumeReadableFile(fixturesDir)
} }
} }
} }
@ -225,22 +225,22 @@ class PathsHelpersTests: FunSpec({
context("WithOneStringArg") { context("WithOneStringArg") {
test("on non-existing path") { test("on non-existing path") {
val path = Helpers.fixturesDir / "i_do_not_exist" val path = fixturesDir / "i_do_not_exist"
shouldThrow<AssertionError> { shouldThrow<AssertionError> {
Helpers.assumeReadableFile("$path") assumeReadableFile("$path")
} }
} }
test("on readable file") { test("on readable file") {
val path = Helpers.fixturesDir / "ast_simple_main.p8" val path = fixturesDir / "ast_simple_main.p8"
withClue("should return the resulting path") { withClue("should return the resulting path") {
Helpers.assumeReadableFile("$path") shouldBe path assumeReadableFile("$path") shouldBe path
} }
} }
test("on directory") { test("on directory") {
shouldThrow<AssertionError> { shouldThrow<AssertionError> {
Helpers.assumeReadableFile("${Helpers.fixturesDir}") assumeReadableFile("${fixturesDir}")
} }
} }
} }
@ -248,20 +248,20 @@ class PathsHelpersTests: FunSpec({
context("WithPathAndStringArgs") { context("WithPathAndStringArgs") {
test("on non-existing path") { test("on non-existing path") {
shouldThrow<java.lang.AssertionError> { shouldThrow<java.lang.AssertionError> {
Helpers.assumeReadableFile(Helpers.fixturesDir, "i_do_not_exist") assumeReadableFile(fixturesDir, "i_do_not_exist")
} }
} }
test("on readable file") { test("on readable file") {
val path = Helpers.fixturesDir / "ast_simple_main.p8" val path = fixturesDir / "ast_simple_main.p8"
withClue("should return the resulting path") { withClue("should return the resulting path") {
Helpers.assumeReadableFile(Helpers.fixturesDir / "ast_simple_main.p8") shouldBe path assumeReadableFile(fixturesDir / "ast_simple_main.p8") shouldBe path
} }
} }
test("on directory") { test("on directory") {
shouldThrow<AssertionError> { shouldThrow<AssertionError> {
Helpers.assumeReadableFile(Helpers.fixturesDir, "..") assumeReadableFile(fixturesDir, "..")
} }
} }
} }
@ -269,19 +269,19 @@ class PathsHelpersTests: FunSpec({
context("WithPathAndPathArgs") { context("WithPathAndPathArgs") {
test("on non-existing path") { test("on non-existing path") {
shouldThrow<java.lang.AssertionError> { shouldThrow<java.lang.AssertionError> {
Helpers.assumeReadableFile(Helpers.fixturesDir, Path("i_do_not_exist")) assumeReadableFile(fixturesDir, Path("i_do_not_exist"))
} }
} }
test("on readable file") { test("on readable file") {
withClue("should return the resulting path") { withClue("should return the resulting path") {
Helpers.assumeReadableFile(Helpers.fixturesDir / Path("ast_simple_main.p8")) shouldBe Helpers.fixturesDir / "ast_simple_main.p8" assumeReadableFile(fixturesDir / Path("ast_simple_main.p8")) shouldBe fixturesDir / "ast_simple_main.p8"
} }
} }
test("on directory") { test("on directory") {
shouldThrow<AssertionError> { shouldThrow<AssertionError> {
Helpers.assumeReadableFile(Helpers.fixturesDir, Path("..")) assumeReadableFile(fixturesDir, Path(".."))
} }
} }
} }
@ -289,19 +289,19 @@ class PathsHelpersTests: FunSpec({
context("WithStringAndStringArgs") { context("WithStringAndStringArgs") {
test("on non-existing path") { test("on non-existing path") {
shouldThrow<java.lang.AssertionError> { shouldThrow<java.lang.AssertionError> {
Helpers.assumeReadableFile("${Helpers.fixturesDir}", "i_do_not_exist") assumeReadableFile("${fixturesDir}", "i_do_not_exist")
} }
} }
test("on readable file") { test("on readable file") {
withClue("should return the resulting path") { withClue("should return the resulting path") {
Helpers.assumeReadableFile(Helpers.fixturesDir / "ast_simple_main.p8") shouldBe Helpers.fixturesDir / "ast_simple_main.p8" assumeReadableFile(fixturesDir / "ast_simple_main.p8") shouldBe fixturesDir / "ast_simple_main.p8"
} }
} }
test("on directory") { test("on directory") {
shouldThrow<AssertionError> { shouldThrow<AssertionError> {
Helpers.assumeReadableFile("${Helpers.fixturesDir}", "..") assumeReadableFile("${fixturesDir}", "..")
} }
} }
} }

View File

@ -28,7 +28,7 @@ dependencies {
implementation project(':codeCore') implementation project(':codeCore')
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk8" implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk8"
implementation "com.michael-bull.kotlin-result:kotlin-result-jvm:1.1.16" implementation "com.michael-bull.kotlin-result:kotlin-result-jvm:1.1.16"
testImplementation 'io.kotest:kotest-runner-junit5-jvm:5.2.3' testImplementation 'io.kotest:kotest-runner-junit5-jvm:5.3.2'
} }
sourceSets { sourceSets {