use kotest tempdir instead of hardcoded output directory

This commit is contained in:
Irmen de Jong
2025-03-14 01:18:33 +01:00
parent 5dd45b714a
commit 7668a3c660
31 changed files with 490 additions and 410 deletions

View File

@@ -1,6 +1,7 @@
package prog8tests.compiler.codegeneration
import io.kotest.core.spec.style.FunSpec
import io.kotest.engine.spec.tempdir
import io.kotest.matchers.shouldBe
import io.kotest.matchers.shouldNotBe
import prog8.code.ast.PtBlock
@@ -15,6 +16,8 @@ import kotlin.io.path.readText
class TestLibrary: FunSpec({
val outputDir = tempdir().toPath()
test("library compilation (x16)") {
val src="""
%address ${'$'}A050
@@ -55,7 +58,7 @@ library {
}
}"""
val result = compileText(Cx16Target(), true, src, writeAssembly = true)!!
val result = compileText(Cx16Target(), true, src, outputDir, writeAssembly = true)!!
val ep = result.codegenAst!!.entrypoint()
val main = ep!!.parent as PtBlock
main.name shouldBe "p8b_main"
@@ -141,7 +144,7 @@ library {
}
}"""
val result = compileText(C64Target(), true, src, writeAssembly = true)!!
val result = compileText(C64Target(), true, src, outputDir, writeAssembly = true)!!
val ep = result.codegenAst!!.entrypoint()
val main = ep!!.parent as PtBlock
main.name shouldBe "p8b_main"