testcase improvement

This commit is contained in:
Irmen de Jong 2024-09-06 22:51:26 +02:00
parent 28b43b3e1d
commit 6d2a36fb2b
3 changed files with 20 additions and 4 deletions

View File

@ -19,6 +19,11 @@ import kotlin.system.exitProcess
fun main(args: Array<String>) {
// NOTE: if your compiler/IDE complains here about "Unresolved reference: buildversion",
// it means that you have to run the gradle task once to generate this file.
// Do that with this command: gradle createVersionFile
println("\nProg8 compiler v${prog8.buildversion.VERSION} by Irmen de Jong (irmen@razorvine.net)")
if('-' in prog8.buildversion.VERSION) {
println("Prerelease version from git commit ${prog8.buildversion.GIT_SHA.take(8)} in branch ${prog8.buildversion.GIT_BRANCH}")

View File

@ -111,16 +111,23 @@ main {
sub start() {
}
}"""
compileText(C64Target(), false, srcWrong1, writeAssembly = false) shouldBe null
val errors = ErrorReporterForTests()
compileText(C64Target(), false, srcWrong1, writeAssembly = false, errors=errors) shouldBe null
errors.errors.size shouldBe 1
errors.errors[0] shouldContain "split can only be used on word arrays"
val srcWrong2 = """
%option enable_floats
main {
float[10] @split sf
sub start() {
}
}"""
compileText(C64Target(), false, srcWrong2, writeAssembly = false) shouldBe null
errors.clear()
compileText(C64Target(), false, srcWrong2, writeAssembly = false, errors=errors) shouldBe null
errors.errors.size shouldBe 1
errors.errors[0] shouldContain "split can only be used on word arrays"
}
test("split word arrays in asm as lsb/msb") {

View File

@ -65,8 +65,12 @@ For normal use, the ``installDist`` task should suffice and after succesful comp
but the actual prog8 compiler should run on all operating systems that provide a java runtime (version 11 or newer).
If you do have trouble building or running the compiler on your operating system, please let me know!
To successfully build and debug in IDEA, you have to manually generate the Antlr-parser classes first.
The easiest way to do this is the following:
To successfully build and debug in IDEA, you have to do two things manually first:
1. you have to generate the buildversion file, do this with the shell command: ``gradle createVersionFile``
2. manually generate the Antlr-parser classes first.
The easiest way to build the parser classes this is the following:
1. make sure you have the Antlr4 plugin installed in IDEA
2. right click the grammar file Prog8ANTLR.g4 in the parser project, and choose "Generate Antlr Recognizer" from the menu.