From 6d2a36fb2bda69eb32af2c988fb75035ebd87834 Mon Sep 17 00:00:00 2001 From: Irmen de Jong Date: Fri, 6 Sep 2024 22:51:26 +0200 Subject: [PATCH] testcase improvement --- compiler/src/prog8/CompilerMain.kt | 5 +++++ compiler/test/codegeneration/TestArrayThings.kt | 11 +++++++++-- docs/source/compiling.rst | 8 ++++++-- 3 files changed, 20 insertions(+), 4 deletions(-) diff --git a/compiler/src/prog8/CompilerMain.kt b/compiler/src/prog8/CompilerMain.kt index d042ce51d..6e120aaed 100644 --- a/compiler/src/prog8/CompilerMain.kt +++ b/compiler/src/prog8/CompilerMain.kt @@ -19,6 +19,11 @@ import kotlin.system.exitProcess fun main(args: Array) { + + // 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}") diff --git a/compiler/test/codegeneration/TestArrayThings.kt b/compiler/test/codegeneration/TestArrayThings.kt index 03192ab9e..d146a7777 100644 --- a/compiler/test/codegeneration/TestArrayThings.kt +++ b/compiler/test/codegeneration/TestArrayThings.kt @@ -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") { diff --git a/docs/source/compiling.rst b/docs/source/compiling.rst index aa5ae35cc..0c8597aa9 100644 --- a/docs/source/compiling.rst +++ b/docs/source/compiling.rst @@ -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.