2024-09-08 14:03:57 +00:00
|
|
|
package prog8tests.compiler
|
2022-09-23 12:12:36 +00:00
|
|
|
|
|
|
|
import io.kotest.core.spec.style.FunSpec
|
|
|
|
import prog8.code.target.VMTarget
|
|
|
|
import kotlin.io.path.deleteExisting
|
|
|
|
import kotlin.io.path.writeText
|
|
|
|
|
|
|
|
|
|
|
|
class TestLaunchEmu: FunSpec({
|
|
|
|
|
|
|
|
test("test launch virtualmachine via target") {
|
|
|
|
val target = VMTarget()
|
2022-09-26 17:03:54 +00:00
|
|
|
val tmpfile = kotlin.io.path.createTempFile(suffix=".p8ir")
|
2022-11-11 22:35:52 +00:00
|
|
|
tmpfile.writeText("""<?xml version="1.0" encoding="utf-8"?>
|
|
|
|
<PROGRAM NAME="test">
|
2022-09-26 17:03:54 +00:00
|
|
|
<OPTIONS>
|
|
|
|
</OPTIONS>
|
|
|
|
|
2022-09-30 13:27:03 +00:00
|
|
|
<ASMSYMBOLS>
|
|
|
|
</ASMSYMBOLS>
|
|
|
|
|
2023-02-19 02:07:55 +00:00
|
|
|
<VARIABLESNOINIT>
|
|
|
|
</VARIABLESNOINIT>
|
|
|
|
<VARIABLESWITHINIT>
|
|
|
|
</VARIABLESWITHINIT>
|
2022-09-26 17:03:54 +00:00
|
|
|
|
|
|
|
<MEMORYMAPPEDVARIABLES>
|
|
|
|
</MEMORYMAPPEDVARIABLES>
|
|
|
|
|
|
|
|
<MEMORYSLABS>
|
|
|
|
</MEMORYSLABS>
|
|
|
|
|
|
|
|
<INITGLOBALS>
|
|
|
|
</INITGLOBALS>
|
|
|
|
|
2023-05-01 21:00:51 +00:00
|
|
|
<BLOCK NAME="main" ADDRESS="" LIBRARY="false" FORCEOUTPUT="false" ALIGN="NONE" POS="[unittest: line 42 col 1-9]">
|
2022-09-26 17:03:54 +00:00
|
|
|
</BLOCK>
|
|
|
|
</PROGRAM>
|
|
|
|
""")
|
2022-09-23 12:12:36 +00:00
|
|
|
target.machine.launchEmulator(0, tmpfile)
|
|
|
|
tmpfile.deleteExisting()
|
|
|
|
}
|
|
|
|
})
|