mirror of
https://github.com/irmen/prog8.git
synced 2025-11-02 13:16:07 +00:00
start implementing ptr deref augmented assigns
This commit is contained in:
@@ -3,21 +3,24 @@ package prog8tests.compiler
|
||||
import io.kotest.core.spec.style.FunSpec
|
||||
import io.kotest.engine.spec.tempdir
|
||||
import io.kotest.matchers.shouldNotBe
|
||||
import prog8.code.target.C64Target
|
||||
import prog8.code.target.VMTarget
|
||||
import prog8.vm.VmRunner
|
||||
import prog8tests.helpers.compileText
|
||||
import kotlin.io.path.readText
|
||||
|
||||
|
||||
class TestPointers: FunSpec( {
|
||||
|
||||
val outputDir = tempdir().toPath()
|
||||
|
||||
xtest("block scoping still parsed correctly") {
|
||||
test("block scoping still parsed correctly") {
|
||||
val src="""
|
||||
main {
|
||||
sub start() {
|
||||
readbyte(&thing.name) ; ok
|
||||
readbyte(&thing.name[1]) ; TODO fix error
|
||||
readbyte(&thing.array[1]) ; TODO fix error
|
||||
readbyte(&thing.name)
|
||||
readbyte(&thing.name[1])
|
||||
readbyte(&thing.array[1])
|
||||
}
|
||||
|
||||
sub readbyte(uword @requirezp ptr) {
|
||||
@@ -29,7 +32,10 @@ thing {
|
||||
str name = "error"
|
||||
ubyte[10] array
|
||||
}"""
|
||||
compileText(VMTarget(), false, src, outputDir, writeAssembly = false) shouldNotBe null
|
||||
|
||||
compileText(C64Target(), false, src, outputDir) shouldNotBe null
|
||||
val result = compileText(VMTarget(), false, src, outputDir)!!
|
||||
val virtfile = result.compilationOptions.outputDir.resolve(result.compilerAst.name + ".p8ir")
|
||||
VmRunner().runProgram(virtfile.readText(), true)
|
||||
}
|
||||
|
||||
})
|
||||
Reference in New Issue
Block a user