mirror of
https://github.com/irmen/prog8.git
synced 2024-12-26 14:29:35 +00:00
update kotest
This commit is contained in:
parent
eea09f4de5
commit
c75bd97537
18
.idea/libraries/io_kotest_assertions_core_jvm.xml
generated
18
.idea/libraries/io_kotest_assertions_core_jvm.xml
generated
@ -1,21 +1,21 @@
|
||||
<component name="libraryTable">
|
||||
<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>
|
||||
<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$/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/1.6.10/kotlin-stdlib-1.6.10.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.21/kotlin-stdlib-jdk8-1.6.21.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/kotlin/kotlin-stdlib-jdk7/1.6.10/kotlin-stdlib-jdk7-1.6.10.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$/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.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$/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/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/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-assertions-api-jvm/5.2.3/kotest-assertions-api-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.3.2/kotest-assertions-api-jvm-5.3.2.jar!/" />
|
||||
</CLASSES>
|
||||
<JAVADOC />
|
||||
<SOURCES />
|
||||
|
18
.idea/libraries/io_kotest_property_jvm.xml
generated
18
.idea/libraries/io_kotest_property_jvm.xml
generated
@ -1,20 +1,20 @@
|
||||
<component name="libraryTable">
|
||||
<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>
|
||||
<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$/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/1.6.10/kotlin-stdlib-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.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/kotlin/kotlin-stdlib-jdk7/1.6.10/kotlin-stdlib-jdk7-1.6.10.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-assertions-shared-jvm/5.2.3/kotest-assertions-shared-jvm-5.2.3.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$/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.3.2/kotest-common-jvm-5.3.2.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.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/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$/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/kotlin/kotlin-stdlib-common/1.6.0/kotlin-stdlib-common-1.6.0.jar!/" />
|
||||
</CLASSES>
|
||||
|
50
.idea/libraries/io_kotest_runner_junit5_jvm.xml
generated
50
.idea/libraries/io_kotest_runner_junit5_jvm.xml
generated
@ -1,38 +1,38 @@
|
||||
<component name="libraryTable">
|
||||
<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>
|
||||
<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-framework-api-jvm/5.2.3/kotest-framework-api-jvm-5.2.3.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-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.3.2/kotest-framework-api-jvm-5.3.2.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$/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-framework-engine-jvm/5.2.3/kotest-framework-engine-jvm-5.2.3.jar!/" />
|
||||
<root url="jar://$MAVEN_REPOSITORY$/io/github/classgraph/classgraph/4.8.138/classgraph-4.8.138.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.3.2/kotest-framework-engine-jvm-5.3.2.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/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/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-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-assertions-core-jvm/5.2.3/kotest-assertions-core-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.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$/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-extensions-jvm/5.2.3/kotest-extensions-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.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$/io/mockk/mockk/1.12.2/mockk-1.12.2.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-dsl/1.12.2/mockk-dsl-1.12.2.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-agent-jvm/1.12.2/mockk-agent-jvm-1.12.2.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-common/1.12.2/mockk-agent-common-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-common/1.12.3/mockk-common-1.12.3.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-dsl-jvm/1.12.3/mockk-dsl-jvm-1.12.3.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.3/mockk-agent-api-1.12.3.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$/net/bytebuddy/byte-buddy/1.12.5/byte-buddy-1.12.5.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$/io/kotest/kotest-framework-concurrency-jvm/5.2.3/kotest-framework-concurrency-jvm-5.2.3.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.6/byte-buddy-agent-1.12.6.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/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!/" />
|
||||
@ -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-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/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/1.6.10/kotlin-stdlib-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.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/kotlin/kotlin-stdlib-jdk7/1.6.10/kotlin-stdlib-jdk7-1.6.10.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-stdlib-jdk7/1.6.21/kotlin-stdlib-jdk7-1.6.21.jar!/" />
|
||||
<root url="jar://$MAVEN_REPOSITORY$/org/jetbrains/kotlin/kotlin-reflect/1.6.21/kotlin-reflect-1.6.21.jar!/" />
|
||||
</CLASSES>
|
||||
<JAVADOC />
|
||||
<SOURCES />
|
||||
|
@ -40,7 +40,7 @@ dependencies {
|
||||
implementation 'org.jetbrains.kotlinx:kotlinx-cli:0.3.4'
|
||||
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 {
|
||||
|
@ -39,9 +39,9 @@ class TestModuleImporter: FunSpec({
|
||||
|
||||
context("WithInvalidPath") {
|
||||
test("testNonexisting") {
|
||||
val dirRel = Helpers.assumeDirectory(".", Helpers.workingDir.relativize(Helpers.fixturesDir))
|
||||
val dirRel = assumeDirectory(".", workingDir.relativize(fixturesDir))
|
||||
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 error1 = importer.importModule(srcPathRel).getErrorOrElse { fail("should have import error") }
|
||||
withClue(".file should be normalized") {
|
||||
@ -62,7 +62,7 @@ class TestModuleImporter: FunSpec({
|
||||
}
|
||||
|
||||
test("testDirectory") {
|
||||
val srcPathRel = Helpers.assumeDirectory(Helpers.workingDir.relativize(Helpers.fixturesDir))
|
||||
val srcPathRel = assumeDirectory(workingDir.relativize(fixturesDir))
|
||||
val srcPathAbs = srcPathRel.absolute()
|
||||
val searchIn = Path(".", "$srcPathRel").invariantSeparatorsPathString
|
||||
val importer = makeImporter(null, searchIn)
|
||||
@ -95,11 +95,11 @@ class TestModuleImporter: FunSpec({
|
||||
|
||||
test("testAbsolute") {
|
||||
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 }
|
||||
val importer = makeImporter(null, searchIn)
|
||||
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 }
|
||||
program.modules.size shouldBe 2
|
||||
@ -109,11 +109,11 @@ class TestModuleImporter: FunSpec({
|
||||
|
||||
test("testRelativeToWorkingDir") {
|
||||
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 }
|
||||
val importer = makeImporter(null, searchIn)
|
||||
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") {
|
||||
path.isAbsolute shouldBe false
|
||||
}
|
||||
@ -126,12 +126,12 @@ class TestModuleImporter: FunSpec({
|
||||
|
||||
test("testRelativeTo1stDirInSearchList") {
|
||||
val searchIn = Path(".")
|
||||
.div(Helpers.workingDir.relativize(Helpers.fixturesDir))
|
||||
.div(workingDir.relativize(fixturesDir))
|
||||
.invariantSeparatorsPathString
|
||||
val importer = makeImporter(null, searchIn)
|
||||
val fileName = "ast_simple_main.p8"
|
||||
val path = Path(".", fileName)
|
||||
Helpers.assumeReadableFile(searchIn, path)
|
||||
assumeReadableFile(searchIn, path)
|
||||
|
||||
val module = importer.importModule(path).getOrElse { throw it }
|
||||
program.modules.size shouldBe 2
|
||||
@ -141,9 +141,9 @@ class TestModuleImporter: FunSpec({
|
||||
|
||||
context("WithBadFile") {
|
||||
test("testWithSyntaxError") {
|
||||
val searchIn = Helpers.assumeDirectory("./", Helpers.workingDir.relativize(Helpers.fixturesDir))
|
||||
val searchIn = assumeDirectory("./", workingDir.relativize(fixturesDir))
|
||||
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) }
|
||||
|
||||
@ -160,10 +160,10 @@ class TestModuleImporter: FunSpec({
|
||||
}
|
||||
|
||||
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 importing = Helpers.assumeReadableFile(Helpers.fixturesDir, "import_file_with_syntax_error.p8")
|
||||
val imported = Helpers.assumeReadableFile(Helpers.fixturesDir, "file_with_syntax_error.p8")
|
||||
val importing = assumeReadableFile(fixturesDir, "import_file_with_syntax_error.p8")
|
||||
val imported = assumeReadableFile(fixturesDir, "file_with_syntax_error.p8")
|
||||
|
||||
val act = { importer.importModule(importing) }
|
||||
|
||||
@ -194,11 +194,11 @@ class TestModuleImporter: FunSpec({
|
||||
context("ImportLibraryModule") {
|
||||
context("WithInvalidName") {
|
||||
test("testWithNonExistingName") {
|
||||
val searchIn = Helpers.assumeDirectory("./", Helpers.workingDir.relativize(Helpers.fixturesDir))
|
||||
val searchIn = assumeDirectory("./", workingDir.relativize(fixturesDir))
|
||||
val errors = ErrorReporterForTests(false)
|
||||
val importer = makeImporter(errors, searchIn.invariantSeparatorsPathString)
|
||||
val filenameNoExt = Helpers.assumeNotExists(Helpers.fixturesDir, "i_do_not_exist").name
|
||||
val filenameWithExt = Helpers.assumeNotExists(Helpers.fixturesDir, "i_do_not_exist.p8").name
|
||||
val filenameNoExt = assumeNotExists(fixturesDir, "i_do_not_exist").name
|
||||
val filenameWithExt = assumeNotExists(fixturesDir, "i_do_not_exist.p8").name
|
||||
|
||||
repeat(2) { n ->
|
||||
val result = importer.importLibraryModule(filenameNoExt)
|
||||
@ -221,9 +221,9 @@ class TestModuleImporter: FunSpec({
|
||||
context("WithValidName") {
|
||||
context("WithBadFile") {
|
||||
test("testWithSyntaxError") {
|
||||
val searchIn = Helpers.assumeDirectory("./", Helpers.workingDir.relativize(Helpers.fixturesDir))
|
||||
val searchIn = assumeDirectory("./", workingDir.relativize(fixturesDir))
|
||||
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") {
|
||||
shouldThrow<ParseError>()
|
||||
@ -241,10 +241,10 @@ class TestModuleImporter: FunSpec({
|
||||
|
||||
|
||||
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 importing = Helpers.assumeReadableFile(Helpers.fixturesDir, "import_file_with_syntax_error.p8")
|
||||
val imported = Helpers.assumeReadableFile(Helpers.fixturesDir, "file_with_syntax_error.p8")
|
||||
val importing = assumeReadableFile(fixturesDir, "import_file_with_syntax_error.p8")
|
||||
val imported = assumeReadableFile(fixturesDir, "file_with_syntax_error.p8")
|
||||
|
||||
val act = { importer.importLibraryModule(importing.nameWithoutExtension) }
|
||||
|
||||
|
@ -8,8 +8,10 @@ import prog8.code.target.Cx16Target
|
||||
import prog8.compiler.CompilationResult
|
||||
import prog8.compiler.CompilerArguments
|
||||
import prog8.compiler.compileProgram
|
||||
import prog8tests.helpers.Combinations
|
||||
import prog8tests.helpers.Helpers
|
||||
import prog8tests.helpers.assumeDirectory
|
||||
import prog8tests.helpers.cartesianProduct
|
||||
import prog8tests.helpers.outputDir
|
||||
import prog8tests.helpers.workingDir
|
||||
import java.nio.file.Path
|
||||
import kotlin.io.path.absolute
|
||||
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.
|
||||
*/
|
||||
|
||||
private val examplesDir = Helpers.assumeDirectory(Helpers.workingDir, "../examples")
|
||||
private val examplesDir = assumeDirectory(workingDir, "../examples")
|
||||
|
||||
private fun compileTheThing(filepath: Path, optimize: Boolean, target: ICompilationTarget): CompilationResult? {
|
||||
val args = CompilerArguments(
|
||||
@ -35,7 +37,7 @@ private fun compileTheThing(filepath: Path, optimize: Boolean, target: ICompilat
|
||||
asmListfile = false,
|
||||
experimentalCodegen = false,
|
||||
compilationTarget = target.name,
|
||||
outputDir = Helpers.outputDir
|
||||
outputDir = outputDir
|
||||
)
|
||||
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> {
|
||||
val searchIn = mutableListOf(examplesDir)
|
||||
if (target is Cx16Target) {
|
||||
searchIn.add(0, Helpers.assumeDirectory(examplesDir, "cx16"))
|
||||
searchIn.add(0, assumeDirectory(examplesDir, "cx16"))
|
||||
}
|
||||
val filepath = searchIn.asSequence()
|
||||
.map { it.resolve("$source.p8") }
|
||||
.map { it.normalize().absolute() }
|
||||
.map { Helpers.workingDir.relativize(it) }
|
||||
.map { workingDir.relativize(it) }
|
||||
.first { it.exists() }
|
||||
val displayName = "${examplesDir.relativize(filepath.absolute())}: ${target.name}, optimize=$optimize"
|
||||
return Pair(displayName, filepath)
|
||||
@ -57,7 +59,7 @@ private fun prepareTestFiles(source: String, optimize: Boolean, target: ICompila
|
||||
|
||||
class TestCompilerOnExamplesC64: FunSpec({
|
||||
|
||||
val onlyC64 = Combinations.cartesianProduct(
|
||||
val onlyC64 = cartesianProduct(
|
||||
listOf(
|
||||
"balloonflight",
|
||||
"bdmusic",
|
||||
@ -84,7 +86,7 @@ class TestCompilerOnExamplesC64: FunSpec({
|
||||
|
||||
class TestCompilerOnExamplesCx16: FunSpec({
|
||||
|
||||
val onlyCx16 = Combinations.cartesianProduct(
|
||||
val onlyCx16 = cartesianProduct(
|
||||
listOf(
|
||||
"vtui/testvtui",
|
||||
"amiga",
|
||||
@ -116,7 +118,7 @@ class TestCompilerOnExamplesCx16: FunSpec({
|
||||
|
||||
class TestCompilerOnExamplesBothC64andCx16: FunSpec({
|
||||
|
||||
val bothCx16AndC64 = Combinations.cartesianProduct(
|
||||
val bothCx16AndC64 = cartesianProduct(
|
||||
listOf(
|
||||
"animals",
|
||||
"balls",
|
||||
|
@ -10,7 +10,7 @@ import prog8.ast.expressions.StringLiteral
|
||||
import prog8.ast.statements.FunctionCallStatement
|
||||
import prog8.ast.statements.Label
|
||||
import prog8.code.target.Cx16Target
|
||||
import prog8tests.helpers.Helpers
|
||||
import prog8tests.helpers.*
|
||||
import prog8tests.helpers.compileFile
|
||||
import kotlin.io.path.name
|
||||
|
||||
@ -25,11 +25,11 @@ class TestCompilerOnImportsAndIncludes: FunSpec({
|
||||
context("Import") {
|
||||
|
||||
test("testImportFromSameFolder") {
|
||||
val filepath = Helpers.assumeReadableFile(Helpers.fixturesDir, "importFromSameFolder.p8")
|
||||
Helpers.assumeReadableFile(Helpers.fixturesDir, "foo_bar.p8")
|
||||
val filepath = assumeReadableFile(fixturesDir, "importFromSameFolder.p8")
|
||||
assumeReadableFile(fixturesDir, "foo_bar.p8")
|
||||
|
||||
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 startSub = program.entrypoint
|
||||
@ -47,11 +47,11 @@ class TestCompilerOnImportsAndIncludes: FunSpec({
|
||||
|
||||
context("AsmInclude") {
|
||||
test("testAsmIncludeFromSameFolder") {
|
||||
val filepath = Helpers.assumeReadableFile(Helpers.fixturesDir, "asmIncludeFromSameFolder.p8")
|
||||
Helpers.assumeReadableFile(Helpers.fixturesDir, "foo_bar.asm")
|
||||
val filepath = assumeReadableFile(fixturesDir, "asmIncludeFromSameFolder.p8")
|
||||
assumeReadableFile(fixturesDir, "foo_bar.asm")
|
||||
|
||||
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 startSub = program.entrypoint
|
||||
@ -72,17 +72,17 @@ class TestCompilerOnImportsAndIncludes: FunSpec({
|
||||
|
||||
context("Asmbinary") {
|
||||
test("testAsmbinaryDirectiveWithNonExistingFile") {
|
||||
val p8Path = Helpers.assumeReadableFile(Helpers.fixturesDir, "asmBinaryNonExisting.p8")
|
||||
Helpers.assumeNotExists(Helpers.fixturesDir, "i_do_not_exist.bin")
|
||||
val p8Path = assumeReadableFile(fixturesDir, "asmBinaryNonExisting.p8")
|
||||
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") {
|
||||
val p8Path = Helpers.assumeReadableFile(Helpers.fixturesDir, "asmBinaryNonReadable.p8")
|
||||
Helpers.assumeDirectory(Helpers.fixturesDir, "subFolder")
|
||||
val p8Path = assumeReadableFile(fixturesDir, "asmBinaryNonReadable.p8")
|
||||
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(
|
||||
@ -93,18 +93,18 @@ class TestCompilerOnImportsAndIncludes: FunSpec({
|
||||
tests.forEach {
|
||||
val (where, p8Str, _) = it
|
||||
test("%asmbinary from ${where}folder") {
|
||||
val p8Path = Helpers.assumeReadableFile(Helpers.fixturesDir, p8Str)
|
||||
// val binPath = Helpers.assumeReadableFile(Helpers.fixturesDir, binStr)
|
||||
val p8Path = assumeReadableFile(fixturesDir, p8Str)
|
||||
// val binPath = assumeReadableFile(fixturesDir, binStr)
|
||||
|
||||
// the bug we're testing for (#54) was hidden if outputDir == workingDir
|
||||
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 " +
|
||||
"should be relative to the generated .asm file (in output 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
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -17,9 +17,9 @@ import prog8.code.core.Encoding
|
||||
import prog8.code.core.Position
|
||||
import prog8.code.target.C64Target
|
||||
import prog8.code.target.Cx16Target
|
||||
import prog8tests.helpers.Combinations
|
||||
import prog8tests.helpers.ErrorReporterForTests
|
||||
import prog8tests.helpers.compileText
|
||||
import prog8tests.helpers.cartesianProduct
|
||||
|
||||
|
||||
/**
|
||||
@ -93,7 +93,7 @@ class TestCompilerOnRanges: FunSpec({
|
||||
}
|
||||
|
||||
context("floatArrayInitializerWithRange") {
|
||||
val combos = Combinations.cartesianProduct(
|
||||
val combos = cartesianProduct(
|
||||
listOf("", "42", "41"), // sizeInDecl
|
||||
listOf("%import floats", ""), // optEnableFloats
|
||||
listOf(Cx16Target(), C64Target()), // platform
|
||||
|
@ -6,7 +6,10 @@ import prog8.code.target.Cx16Target
|
||||
import prog8.compiler.CompilationResult
|
||||
import prog8.compiler.CompilerArguments
|
||||
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 kotlin.io.path.absolute
|
||||
import kotlin.io.path.createTempFile
|
||||
@ -23,7 +26,7 @@ class TestCompilerOptionSourcedirs: FunSpec({
|
||||
lateinit var tempFileInWorkingDir: Path
|
||||
|
||||
beforeSpec {
|
||||
tempFileInWorkingDir = createTempFile(directory = Helpers.workingDir, prefix = "tmp_", suffix = ".p8")
|
||||
tempFileInWorkingDir = createTempFile(directory = workingDir, prefix = "tmp_", suffix = ".p8")
|
||||
.also { it.writeText("""
|
||||
main {
|
||||
sub start() {
|
||||
@ -49,39 +52,39 @@ class TestCompilerOptionSourcedirs: FunSpec({
|
||||
experimentalCodegen = false,
|
||||
compilationTarget = Cx16Target.NAME,
|
||||
sourceDirs,
|
||||
Helpers.outputDir
|
||||
outputDir
|
||||
)
|
||||
return compileProgram(args)
|
||||
}
|
||||
|
||||
test("testAbsoluteFilePathInWorkingDir") {
|
||||
val filepath = Helpers.assumeReadableFile(tempFileInWorkingDir.absolute())
|
||||
val filepath = assumeReadableFile(tempFileInWorkingDir.absolute())
|
||||
compileFile(filepath, listOf()) shouldNotBe null
|
||||
}
|
||||
|
||||
test("testFilePathInWorkingDirRelativeToWorkingDir") {
|
||||
val filepath = Helpers.assumeReadableFile(Helpers.workingDir.relativize(tempFileInWorkingDir.absolute()))
|
||||
val filepath = assumeReadableFile(workingDir.relativize(tempFileInWorkingDir.absolute()))
|
||||
compileFile(filepath, listOf()) shouldNotBe null
|
||||
}
|
||||
|
||||
test("testFilePathInWorkingDirRelativeTo1stInSourcedirs") {
|
||||
val filepath = Helpers.assumeReadableFile(tempFileInWorkingDir)
|
||||
compileFile(filepath.fileName, listOf(Helpers.workingDir.toString())) shouldNotBe null
|
||||
val filepath = assumeReadableFile(tempFileInWorkingDir)
|
||||
compileFile(filepath.fileName, listOf(workingDir.toString())) shouldNotBe null
|
||||
}
|
||||
|
||||
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
|
||||
}
|
||||
|
||||
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
|
||||
}
|
||||
|
||||
test("testFilePathOutsideWorkingDirRelativeTo1stInSourcedirs") {
|
||||
val filepath = Helpers.assumeReadableFile(Helpers.fixturesDir, "ast_simple_main.p8")
|
||||
val sourcedirs = listOf("${Helpers.fixturesDir}")
|
||||
val filepath = assumeReadableFile(fixturesDir, "ast_simple_main.p8")
|
||||
val sourcedirs = listOf("${fixturesDir}")
|
||||
compileFile(filepath.fileName, sourcedirs) shouldNotBe null
|
||||
}
|
||||
|
||||
|
@ -10,8 +10,8 @@ import prog8.code.target.C64Target
|
||||
import prog8.compiler.determineCompilationOptions
|
||||
import prog8.compiler.parseImports
|
||||
import prog8tests.helpers.ErrorReporterForTests
|
||||
import prog8tests.helpers.Helpers
|
||||
import prog8tests.helpers.compileText
|
||||
import prog8tests.helpers.outputDir
|
||||
|
||||
|
||||
class TestImportedModulesOrderAndOptions: FunSpec({
|
||||
@ -85,7 +85,7 @@ main {
|
||||
}
|
||||
"""
|
||||
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)
|
||||
val (program, options, importedfiles) = parseImports(filepath, errors, C64Target(), emptyList())
|
||||
|
||||
|
@ -299,7 +299,7 @@ class TestOptimization: FunSpec({
|
||||
floats = false,
|
||||
noSysInit = true,
|
||||
compTarget = C64Target(),
|
||||
loadAddress = 0u, outputDir= Helpers.outputDir)
|
||||
loadAddress = 0u, outputDir= outputDir)
|
||||
result.program.processAstBeforeAsmGeneration(options, ErrorReporterForTests())
|
||||
|
||||
// assignment is now split into:
|
||||
|
@ -23,6 +23,8 @@ import prog8.code.target.cbm.PetsciiEncoding
|
||||
import prog8.parser.ParseError
|
||||
import prog8.parser.Prog8Parser.parseModule
|
||||
import prog8tests.helpers.*
|
||||
import prog8tests.helpers.DummyFunctions
|
||||
import prog8tests.helpers.DummyMemsizer
|
||||
import kotlin.io.path.Path
|
||||
import kotlin.io.path.isRegularFile
|
||||
import kotlin.io.path.name
|
||||
@ -173,8 +175,8 @@ class TestProg8Parser: FunSpec( {
|
||||
|
||||
context("ImportDirectives") {
|
||||
test("should not be looked into by the parser") {
|
||||
val importedNoExt = Helpers.assumeNotExists(Helpers.fixturesDir, "i_do_not_exist")
|
||||
Helpers.assumeNotExists(Helpers.fixturesDir, "i_do_not_exist.p8")
|
||||
val importedNoExt = assumeNotExists(fixturesDir, "i_do_not_exist")
|
||||
assumeNotExists(fixturesDir, "i_do_not_exist.p8")
|
||||
val text = "%import ${importedNoExt.name}"
|
||||
val module = parseModule(SourceCode.Text(text))
|
||||
|
||||
@ -189,7 +191,7 @@ class TestProg8Parser: FunSpec( {
|
||||
}
|
||||
|
||||
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))
|
||||
module.statements.size shouldBe 0
|
||||
}
|
||||
@ -208,7 +210,7 @@ class TestProg8Parser: FunSpec( {
|
||||
}
|
||||
|
||||
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))
|
||||
module.name shouldBe path.nameWithoutExtension
|
||||
}
|
||||
@ -271,7 +273,7 @@ class TestProg8Parser: FunSpec( {
|
||||
}
|
||||
|
||||
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)) }
|
||||
assertPosition(e.position, SourceCode.relative(path).toString(), 2, 6)
|
||||
@ -287,13 +289,13 @@ class TestProg8Parser: FunSpec( {
|
||||
}
|
||||
|
||||
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))
|
||||
assertPositionOf(module, SourceCode.relative(path).toString(), 1, 0)
|
||||
}
|
||||
|
||||
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 mpf = module.position.file
|
||||
@ -357,7 +359,7 @@ class TestProg8Parser: FunSpec( {
|
||||
}
|
||||
|
||||
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))
|
||||
assertSomethingForAllNodes(module) {
|
||||
Path(it.position.file).isAbsolute shouldBe false
|
||||
|
@ -6,7 +6,10 @@ import io.kotest.matchers.shouldBe
|
||||
import io.kotest.matchers.string.shouldContain
|
||||
import prog8.code.core.SourceCode
|
||||
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
|
||||
|
||||
|
||||
@ -29,26 +32,26 @@ class TestSourceCode: AnnotationSpec() {
|
||||
@Test
|
||||
fun testFromPathWithNonExistingPath() {
|
||||
val filename = "i_do_not_exist.p8"
|
||||
val path = Helpers.assumeNotExists(Helpers.fixturesDir, filename)
|
||||
val path = assumeNotExists(fixturesDir, filename)
|
||||
shouldThrow<NoSuchFileException> { SourceCode.File(path) }
|
||||
}
|
||||
|
||||
@Test
|
||||
fun testFromPathWithMissingExtension_p8() {
|
||||
val pathWithoutExt = Helpers.assumeNotExists(Helpers.fixturesDir,"simple_main")
|
||||
Helpers.assumeReadableFile(Helpers.fixturesDir,"ast_simple_main.p8")
|
||||
val pathWithoutExt = assumeNotExists(fixturesDir,"simple_main")
|
||||
assumeReadableFile(fixturesDir,"ast_simple_main.p8")
|
||||
shouldThrow<NoSuchFileException> { SourceCode.File(pathWithoutExt) }
|
||||
}
|
||||
|
||||
@Test
|
||||
fun testFromPathWithDirectory() {
|
||||
shouldThrow<FileSystemException> { SourceCode.File(Helpers.fixturesDir) }
|
||||
shouldThrow<FileSystemException> { SourceCode.File(fixturesDir) }
|
||||
}
|
||||
|
||||
@Test
|
||||
fun testFromPathWithExistingPath() {
|
||||
val filename = "ast_simple_main.p8"
|
||||
val path = Helpers.assumeReadableFile(Helpers.fixturesDir, filename)
|
||||
val path = assumeReadableFile(fixturesDir, filename)
|
||||
val src = SourceCode.File(path)
|
||||
val expectedOrigin = SourceCode.relative(path).toString()
|
||||
src.origin shouldBe expectedOrigin
|
||||
@ -61,7 +64,7 @@ class TestSourceCode: AnnotationSpec() {
|
||||
fun testFromPathWithExistingNonNormalizedPath() {
|
||||
val filename = "ast_simple_main.p8"
|
||||
val path = Path(".", "test", "..", "test", "fixtures", filename)
|
||||
val srcFile = Helpers.assumeReadableFile(path).toFile()
|
||||
val srcFile = assumeReadableFile(path).toFile()
|
||||
val src = SourceCode.File(path)
|
||||
val expectedOrigin = SourceCode.relative(path).toString()
|
||||
src.origin shouldBe expectedOrigin
|
||||
@ -71,7 +74,7 @@ class TestSourceCode: AnnotationSpec() {
|
||||
@Test
|
||||
fun testFromResourcesWithExistingP8File_withoutLeadingSlash() {
|
||||
val pathString = "prog8lib/math.p8"
|
||||
val srcFile = Helpers.assumeReadableFile(Helpers.resourcesDir, pathString).toFile()
|
||||
val srcFile = assumeReadableFile(resourcesDir, pathString).toFile()
|
||||
val src = SourceCode.Resource(pathString)
|
||||
|
||||
src.origin shouldBe "$libraryFilePrefix/$pathString"
|
||||
@ -83,7 +86,7 @@ class TestSourceCode: AnnotationSpec() {
|
||||
@Test
|
||||
fun testFromResourcesWithExistingP8File_withLeadingSlash() {
|
||||
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)
|
||||
|
||||
src.origin shouldBe "$libraryFilePrefix$pathString"
|
||||
@ -93,7 +96,7 @@ class TestSourceCode: AnnotationSpec() {
|
||||
@Test
|
||||
fun testFromResourcesWithExistingAsmFile_withoutLeadingSlash() {
|
||||
val pathString = "prog8lib/math.asm"
|
||||
val srcFile = Helpers.assumeReadableFile(Helpers.resourcesDir, pathString).toFile()
|
||||
val srcFile = assumeReadableFile(resourcesDir, pathString).toFile()
|
||||
val src = SourceCode.Resource(pathString)
|
||||
|
||||
src.origin shouldBe "$libraryFilePrefix/$pathString"
|
||||
@ -104,7 +107,7 @@ class TestSourceCode: AnnotationSpec() {
|
||||
@Test
|
||||
fun testFromResourcesWithExistingAsmFile_withLeadingSlash() {
|
||||
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)
|
||||
|
||||
src.origin shouldBe "$libraryFilePrefix$pathString"
|
||||
@ -114,7 +117,7 @@ class TestSourceCode: AnnotationSpec() {
|
||||
@Test
|
||||
fun testFromResourcesWithNonNormalizedPath() {
|
||||
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)
|
||||
|
||||
src.origin shouldBe "$libraryFilePrefix/prog8lib/math.p8"
|
||||
@ -126,14 +129,14 @@ class TestSourceCode: AnnotationSpec() {
|
||||
@Test
|
||||
fun testFromResourcesWithNonExistingFile_withLeadingSlash() {
|
||||
val pathString = "/prog8lib/i_do_not_exist"
|
||||
Helpers.assumeNotExists(Helpers.resourcesDir, pathString.substring(1))
|
||||
assumeNotExists(resourcesDir, pathString.substring(1))
|
||||
|
||||
shouldThrow<NoSuchFileException> { SourceCode.Resource(pathString) }
|
||||
}
|
||||
@Test
|
||||
fun testFromResourcesWithNonExistingFile_withoutLeadingSlash() {
|
||||
val pathString = "prog8lib/i_do_not_exist"
|
||||
Helpers.assumeNotExists(Helpers.resourcesDir, pathString)
|
||||
assumeNotExists(resourcesDir, pathString)
|
||||
|
||||
shouldThrow<NoSuchFileException> { SourceCode.Resource(pathString) }
|
||||
}
|
||||
|
@ -19,13 +19,13 @@ internal fun compileFile(
|
||||
optimize: Boolean,
|
||||
fileDir: Path,
|
||||
fileName: String,
|
||||
outputDir: Path = prog8tests.helpers.Helpers.outputDir,
|
||||
outputDir: Path = prog8tests.helpers.outputDir,
|
||||
errors: IErrorReporter? = null,
|
||||
writeAssembly: Boolean = true,
|
||||
optFloatExpr: Boolean = true
|
||||
) : CompilationResult? {
|
||||
val filepath = fileDir.resolve(fileName)
|
||||
Helpers.assumeReadableFile(filepath)
|
||||
assumeReadableFile(filepath)
|
||||
val args = CompilerArguments(
|
||||
filepath,
|
||||
optimize,
|
||||
@ -56,7 +56,7 @@ internal fun compileText(
|
||||
writeAssembly: Boolean = true,
|
||||
optFloatExpr: Boolean = true
|
||||
) : 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
|
||||
filePath.toFile().writeText(sourceText)
|
||||
return compileFile(platform, optimize, filePath.parent, filePath.name, errors=errors, writeAssembly=writeAssembly, optFloatExpr = optFloatExpr)
|
||||
@ -71,7 +71,7 @@ internal fun generateAssembly(
|
||||
floats = true,
|
||||
noSysInit = true,
|
||||
compTarget = C64Target(),
|
||||
loadAddress = 0u, outputDir = Helpers.outputDir)
|
||||
loadAddress = 0u, outputDir = outputDir)
|
||||
coptions.compTarget.machine.zeropage = C64Zeropage(coptions)
|
||||
val st = SymbolTableMaker().makeFrom(program)
|
||||
val errors = ErrorReporterForTests()
|
||||
|
@ -1,68 +1,66 @@
|
||||
package prog8tests.helpers
|
||||
|
||||
object Combinations {
|
||||
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()
|
||||
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()
|
||||
}
|
||||
|
||||
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>> {
|
||||
return sequence {
|
||||
for (a in c1)
|
||||
for (b in c2)
|
||||
for (c in c3)
|
||||
yield(Triple(a, b, c))
|
||||
}
|
||||
data class Product<out T, out U, out V, out W>(val first: T, val second: U, val third: V, val fourth: W)
|
||||
|
||||
fun <T, U, V, W> cartesianProduct(
|
||||
c1: Collection<T>,
|
||||
c2: Collection<U>,
|
||||
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(
|
||||
c1: Collection<T>,
|
||||
c2: Collection<U>,
|
||||
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))
|
||||
}
|
||||
}
|
||||
fun <A, B, C, R> mapCombinations(
|
||||
dim1: Iterable<A>,
|
||||
dim2: Iterable<B>,
|
||||
dim3: Iterable<C>,
|
||||
combine3: (A, B, C) -> R
|
||||
) =
|
||||
sequence {
|
||||
for (a in dim1)
|
||||
for (b in dim2)
|
||||
for (c in dim3)
|
||||
yield(combine3(a, b, c))
|
||||
}.toList()
|
||||
|
||||
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 <A, B, C, R> mapCombinations(
|
||||
dim1: Iterable<A>,
|
||||
dim2: Iterable<B>,
|
||||
dim3: Iterable<C>,
|
||||
combine3: (A, B, C) -> R
|
||||
) =
|
||||
sequence {
|
||||
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()
|
||||
}
|
||||
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()
|
||||
|
@ -7,69 +7,66 @@ import java.nio.file.Path
|
||||
import kotlin.io.path.*
|
||||
|
||||
|
||||
object Helpers {
|
||||
val workingDir = assumeDirectory("").absolute() // Note: "." does NOT work..!
|
||||
val fixturesDir = assumeDirectory(workingDir, "test/fixtures")
|
||||
val resourcesDir = assumeDirectory(workingDir, "res")
|
||||
val outputDir: Path =
|
||||
createIfNotExists(workingDir, "build/tmp/test").also { assumeDirectory(workingDir, "build/tmp/test") }
|
||||
val workingDir = assumeDirectory("").absolute() // Note: "." does NOT work..!
|
||||
val fixturesDir = assumeDirectory(workingDir, "test/fixtures")
|
||||
val resourcesDir = assumeDirectory(workingDir, "res")
|
||||
val outputDir: Path =
|
||||
createIfNotExists(workingDir, "build/tmp/test").also { assumeDirectory(workingDir, "build/tmp/test") }
|
||||
|
||||
fun createIfNotExists(workingDir: Path, path: String): Path {
|
||||
val dir = workingDir / path
|
||||
if (!dir.toFile().isDirectory)
|
||||
Files.createDirectories(dir)
|
||||
return dir
|
||||
fun createIfNotExists(workingDir: Path, path: String): Path {
|
||||
val dir = workingDir / path
|
||||
if (!dir.toFile().isDirectory)
|
||||
Files.createDirectories(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 {
|
||||
withClue("sanity check: should not exist: ${path.absolute()}") {
|
||||
path.exists() shouldBe false
|
||||
}
|
||||
return path
|
||||
fun assumeNotExists(pathStr: String): Path = assumeNotExists(Path(pathStr))
|
||||
fun assumeNotExists(path: Path, other: String): Path = assumeNotExists(path / other)
|
||||
|
||||
fun assumeReadable(path: Path): Path {
|
||||
withClue("sanity check: should be readable: ${path.absolute()}") {
|
||||
path.isReadable() shouldBe true
|
||||
}
|
||||
return path
|
||||
}
|
||||
|
||||
fun assumeNotExists(pathStr: String): Path = assumeNotExists(Path(pathStr))
|
||||
fun assumeNotExists(path: Path, other: String): Path = assumeNotExists(path / other)
|
||||
|
||||
fun assumeReadable(path: Path): Path {
|
||||
withClue("sanity check: should be readable: ${path.absolute()}") {
|
||||
path.isReadable() shouldBe true
|
||||
}
|
||||
return path
|
||||
fun assumeReadableFile(path: Path): Path {
|
||||
withClue("sanity check: should be normal file: ${path.absolute()}") {
|
||||
path.isRegularFile() shouldBe true
|
||||
}
|
||||
return assumeReadable(path)
|
||||
}
|
||||
|
||||
fun assumeReadableFile(path: Path): Path {
|
||||
withClue("sanity check: should be normal file: ${path.absolute()}") {
|
||||
path.isRegularFile() shouldBe true
|
||||
}
|
||||
return assumeReadable(path)
|
||||
fun assumeReadableFile(pathStr: String): Path = assumeReadableFile(Path(pathStr))
|
||||
fun assumeReadableFile(pathStr: String, other: Path): Path = assumeReadableFile(Path(pathStr), other)
|
||||
fun assumeReadableFile(pathStr: String, other: String): Path = assumeReadableFile(Path(pathStr), other)
|
||||
fun assumeReadableFile(path: Path, other: String): Path = assumeReadableFile(path / 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 assumeReadableFile(pathStr: String): Path = assumeReadableFile(Path(pathStr))
|
||||
fun assumeReadableFile(pathStr: String, other: Path): Path = assumeReadableFile(Path(pathStr), other)
|
||||
fun assumeReadableFile(pathStr: String, other: String): Path = assumeReadableFile(Path(pathStr), other)
|
||||
fun assumeReadableFile(path: Path, other: String): Path = assumeReadableFile(path / 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)
|
||||
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(
|
||||
"Directories are checked automatically at init.",
|
||||
ReplaceWith("/* nothing */")
|
||||
)
|
||||
@Suppress("UNUSED_PARAMETER")
|
||||
fun sanityCheckDirectories(workingDirName: String? = null) {
|
||||
}
|
||||
|
||||
}
|
||||
@Deprecated(
|
||||
"Directories are checked automatically at init.",
|
||||
ReplaceWith("/* nothing */")
|
||||
)
|
||||
@Suppress("UNUSED_PARAMETER")
|
||||
fun sanityCheckDirectories(workingDirName: String? = null) {
|
||||
}
|
||||
|
@ -4,7 +4,7 @@ import io.kotest.assertions.throwables.shouldThrow
|
||||
import io.kotest.assertions.withClue
|
||||
import io.kotest.core.spec.style.FunSpec
|
||||
import io.kotest.matchers.shouldBe
|
||||
import prog8tests.helpers.Helpers
|
||||
import prog8tests.helpers.*
|
||||
import kotlin.io.path.Path
|
||||
import kotlin.io.path.div
|
||||
|
||||
@ -20,21 +20,21 @@ class PathsHelpersTests: FunSpec({
|
||||
context("WithOnePathArg") {
|
||||
|
||||
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") {
|
||||
Helpers.assumeNotExists(path) shouldBe path
|
||||
assumeNotExists(path) shouldBe path
|
||||
}
|
||||
}
|
||||
|
||||
test("on existing file") {
|
||||
shouldThrow<java.lang.AssertionError> {
|
||||
Helpers.assumeNotExists(Helpers.fixturesDir / "ast_simple_main.p8")
|
||||
assumeNotExists(fixturesDir / "ast_simple_main.p8")
|
||||
}
|
||||
}
|
||||
|
||||
test("on existing directory") {
|
||||
shouldThrow<java.lang.AssertionError> {
|
||||
Helpers.assumeNotExists(Helpers.fixturesDir)
|
||||
assumeNotExists(fixturesDir)
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -42,22 +42,22 @@ class PathsHelpersTests: FunSpec({
|
||||
context("WithOneStringArg") {
|
||||
|
||||
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") {
|
||||
Helpers.assumeNotExists("$path") shouldBe path
|
||||
assumeNotExists("$path") shouldBe path
|
||||
}
|
||||
}
|
||||
|
||||
test("on existing file") {
|
||||
val path = Helpers.fixturesDir / "ast_simple_main.p8"
|
||||
val path = fixturesDir / "ast_simple_main.p8"
|
||||
shouldThrow<java.lang.AssertionError> {
|
||||
Helpers.assumeNotExists("$path")
|
||||
assumeNotExists("$path")
|
||||
}
|
||||
}
|
||||
|
||||
test("on existing directory") {
|
||||
shouldThrow<java.lang.AssertionError> {
|
||||
Helpers.assumeNotExists("${Helpers.fixturesDir}")
|
||||
assumeNotExists("${fixturesDir}")
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -65,21 +65,21 @@ class PathsHelpersTests: FunSpec({
|
||||
context("WithPathAndStringArgs") {
|
||||
|
||||
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") {
|
||||
Helpers.assumeNotExists(Helpers.fixturesDir / "i_do_not_exist") shouldBe path
|
||||
assumeNotExists(fixturesDir / "i_do_not_exist") shouldBe path
|
||||
}
|
||||
}
|
||||
|
||||
test("on existing file") {
|
||||
shouldThrow<java.lang.AssertionError> {
|
||||
Helpers.assumeNotExists(Helpers.fixturesDir, "ast_simple_main.p8")
|
||||
assumeNotExists(fixturesDir, "ast_simple_main.p8")
|
||||
}
|
||||
}
|
||||
|
||||
test("on existing directory") {
|
||||
shouldThrow<java.lang.AssertionError> {
|
||||
Helpers.assumeNotExists(Helpers.fixturesDir, "..")
|
||||
assumeNotExists(fixturesDir, "..")
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -89,46 +89,46 @@ class PathsHelpersTests: FunSpec({
|
||||
|
||||
context("WithOnePathArg") {
|
||||
test("on non-existing path") {
|
||||
val path = Helpers.fixturesDir / "i_do_not_exist"
|
||||
val path = fixturesDir / "i_do_not_exist"
|
||||
shouldThrow<AssertionError> {
|
||||
Helpers.assumeDirectory(path)
|
||||
assumeDirectory(path)
|
||||
}
|
||||
}
|
||||
|
||||
test("on existing file") {
|
||||
val path = Helpers.fixturesDir / "ast_simple_main.p8"
|
||||
val path = fixturesDir / "ast_simple_main.p8"
|
||||
shouldThrow<AssertionError> {
|
||||
Helpers.assumeDirectory(path)
|
||||
assumeDirectory(path)
|
||||
}
|
||||
}
|
||||
|
||||
test("on existing directory") {
|
||||
val path = Helpers.workingDir
|
||||
val path = workingDir
|
||||
withClue("should return the path") {
|
||||
Helpers.assumeDirectory(path) shouldBe path
|
||||
assumeDirectory(path) shouldBe path
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
context("WithOneStringArg") {
|
||||
test("on non-existing path") {
|
||||
val path = Helpers.fixturesDir / "i_do_not_exist"
|
||||
val path = fixturesDir / "i_do_not_exist"
|
||||
shouldThrow<AssertionError> {
|
||||
Helpers.assumeDirectory("$path")
|
||||
assumeDirectory("$path")
|
||||
}
|
||||
}
|
||||
|
||||
test("on existing file") {
|
||||
val path = Helpers.fixturesDir / "ast_simple_main.p8"
|
||||
val path = fixturesDir / "ast_simple_main.p8"
|
||||
shouldThrow<AssertionError> {
|
||||
Helpers.assumeDirectory("$path")
|
||||
assumeDirectory("$path")
|
||||
}
|
||||
}
|
||||
|
||||
test("on existing directory") {
|
||||
val path = Helpers.workingDir
|
||||
val path = workingDir
|
||||
withClue("should return the path") {
|
||||
Helpers.assumeDirectory("$path") shouldBe path
|
||||
assumeDirectory("$path") shouldBe path
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -136,20 +136,20 @@ class PathsHelpersTests: FunSpec({
|
||||
context("WithPathAndStringArgs") {
|
||||
test("on non-existing path") {
|
||||
shouldThrow<AssertionError> {
|
||||
Helpers.assumeDirectory(Helpers.fixturesDir, "i_do_not_exist")
|
||||
assumeDirectory(fixturesDir, "i_do_not_exist")
|
||||
}
|
||||
}
|
||||
|
||||
test("on existing file") {
|
||||
shouldThrow<AssertionError> {
|
||||
Helpers.assumeDirectory(Helpers.fixturesDir, "ast_simple_main.p8")
|
||||
assumeDirectory(fixturesDir, "ast_simple_main.p8")
|
||||
}
|
||||
}
|
||||
|
||||
test("on existing directory") {
|
||||
val path = Helpers.workingDir / ".."
|
||||
val path = workingDir / ".."
|
||||
withClue("should return resulting path") {
|
||||
Helpers.assumeDirectory(Helpers.workingDir / "..") shouldBe path
|
||||
assumeDirectory(workingDir / "..") shouldBe path
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -157,20 +157,20 @@ class PathsHelpersTests: FunSpec({
|
||||
context("WithStringAndStringArgs") {
|
||||
test("on non-existing path") {
|
||||
shouldThrow<AssertionError> {
|
||||
Helpers.assumeDirectory("${Helpers.fixturesDir}", "i_do_not_exist")
|
||||
assumeDirectory("${fixturesDir}", "i_do_not_exist")
|
||||
}
|
||||
}
|
||||
|
||||
test("on existing file") {
|
||||
shouldThrow<AssertionError> {
|
||||
Helpers.assumeDirectory("${Helpers.fixturesDir}", "ast_simple_main.p8")
|
||||
assumeDirectory("${fixturesDir}", "ast_simple_main.p8")
|
||||
}
|
||||
}
|
||||
|
||||
test("on existing directory") {
|
||||
val path = Helpers.workingDir / ".."
|
||||
val path = workingDir / ".."
|
||||
withClue("should return resulting path") {
|
||||
Helpers.assumeDirectory(Helpers.workingDir / "..") shouldBe path
|
||||
assumeDirectory(workingDir / "..") shouldBe path
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -178,20 +178,20 @@ class PathsHelpersTests: FunSpec({
|
||||
context("WithStringAndPathArgs") {
|
||||
test("on non-existing path") {
|
||||
shouldThrow<AssertionError> {
|
||||
Helpers.assumeDirectory("${Helpers.fixturesDir}", Path("i_do_not_exist"))
|
||||
assumeDirectory("${fixturesDir}", Path("i_do_not_exist"))
|
||||
}
|
||||
}
|
||||
|
||||
test("on existing file") {
|
||||
shouldThrow<AssertionError> {
|
||||
Helpers.assumeDirectory("${Helpers.fixturesDir}", Path("ast_simple_main.p8"))
|
||||
assumeDirectory("${fixturesDir}", Path("ast_simple_main.p8"))
|
||||
}
|
||||
}
|
||||
|
||||
test("on existing directory") {
|
||||
val path = Helpers.workingDir / ".."
|
||||
val path = workingDir / ".."
|
||||
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") {
|
||||
|
||||
test("on non-existing path") {
|
||||
val path = Helpers.fixturesDir / "i_do_not_exist"
|
||||
val path = fixturesDir / "i_do_not_exist"
|
||||
shouldThrow<AssertionError> {
|
||||
Helpers.assumeReadableFile(path)
|
||||
assumeReadableFile(path)
|
||||
}
|
||||
}
|
||||
|
||||
test("on readable file") {
|
||||
val path = Helpers.fixturesDir / "ast_simple_main.p8"
|
||||
val path = fixturesDir / "ast_simple_main.p8"
|
||||
withClue("should return the path") {
|
||||
Helpers.assumeReadableFile(path) shouldBe path
|
||||
assumeReadableFile(path) shouldBe path
|
||||
}
|
||||
}
|
||||
|
||||
test("on directory") {
|
||||
shouldThrow<AssertionError> {
|
||||
Helpers.assumeReadableFile(Helpers.fixturesDir)
|
||||
assumeReadableFile(fixturesDir)
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -225,22 +225,22 @@ class PathsHelpersTests: FunSpec({
|
||||
context("WithOneStringArg") {
|
||||
|
||||
test("on non-existing path") {
|
||||
val path = Helpers.fixturesDir / "i_do_not_exist"
|
||||
val path = fixturesDir / "i_do_not_exist"
|
||||
shouldThrow<AssertionError> {
|
||||
Helpers.assumeReadableFile("$path")
|
||||
assumeReadableFile("$path")
|
||||
}
|
||||
}
|
||||
|
||||
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") {
|
||||
Helpers.assumeReadableFile("$path") shouldBe path
|
||||
assumeReadableFile("$path") shouldBe path
|
||||
}
|
||||
}
|
||||
|
||||
test("on directory") {
|
||||
shouldThrow<AssertionError> {
|
||||
Helpers.assumeReadableFile("${Helpers.fixturesDir}")
|
||||
assumeReadableFile("${fixturesDir}")
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -248,20 +248,20 @@ class PathsHelpersTests: FunSpec({
|
||||
context("WithPathAndStringArgs") {
|
||||
test("on non-existing path") {
|
||||
shouldThrow<java.lang.AssertionError> {
|
||||
Helpers.assumeReadableFile(Helpers.fixturesDir, "i_do_not_exist")
|
||||
assumeReadableFile(fixturesDir, "i_do_not_exist")
|
||||
}
|
||||
}
|
||||
|
||||
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") {
|
||||
Helpers.assumeReadableFile(Helpers.fixturesDir / "ast_simple_main.p8") shouldBe path
|
||||
assumeReadableFile(fixturesDir / "ast_simple_main.p8") shouldBe path
|
||||
}
|
||||
}
|
||||
|
||||
test("on directory") {
|
||||
shouldThrow<AssertionError> {
|
||||
Helpers.assumeReadableFile(Helpers.fixturesDir, "..")
|
||||
assumeReadableFile(fixturesDir, "..")
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -269,19 +269,19 @@ class PathsHelpersTests: FunSpec({
|
||||
context("WithPathAndPathArgs") {
|
||||
test("on non-existing path") {
|
||||
shouldThrow<java.lang.AssertionError> {
|
||||
Helpers.assumeReadableFile(Helpers.fixturesDir, Path("i_do_not_exist"))
|
||||
assumeReadableFile(fixturesDir, Path("i_do_not_exist"))
|
||||
}
|
||||
}
|
||||
|
||||
test("on readable file") {
|
||||
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") {
|
||||
shouldThrow<AssertionError> {
|
||||
Helpers.assumeReadableFile(Helpers.fixturesDir, Path(".."))
|
||||
assumeReadableFile(fixturesDir, Path(".."))
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -289,19 +289,19 @@ class PathsHelpersTests: FunSpec({
|
||||
context("WithStringAndStringArgs") {
|
||||
test("on non-existing path") {
|
||||
shouldThrow<java.lang.AssertionError> {
|
||||
Helpers.assumeReadableFile("${Helpers.fixturesDir}", "i_do_not_exist")
|
||||
assumeReadableFile("${fixturesDir}", "i_do_not_exist")
|
||||
}
|
||||
}
|
||||
|
||||
test("on readable file") {
|
||||
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") {
|
||||
shouldThrow<AssertionError> {
|
||||
Helpers.assumeReadableFile("${Helpers.fixturesDir}", "..")
|
||||
assumeReadableFile("${fixturesDir}", "..")
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -28,7 +28,7 @@ dependencies {
|
||||
implementation project(':codeCore')
|
||||
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk8"
|
||||
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 {
|
||||
|
Loading…
Reference in New Issue
Block a user