Improved error message for invalid instructions

This commit is contained in:
Eduard Urbach 2025-02-13 22:12:57 +01:00
parent 28292a64e3
commit 2b9cecd62b
Signed by: eduard
GPG key ID: 49226B848C78F6C8
3 changed files with 8 additions and 2 deletions

View file

@ -0,0 +1,5 @@
import sys
main() {
sys.write
}

View file

@ -22,7 +22,8 @@ var errs = []struct {
{"ExpectedIfBeforeElse2.q", errors.ExpectedIfBeforeElse},
{"ExpectedStructName.q", errors.ExpectedStructName},
{"ExpectedPackageName.q", errors.ExpectedPackageName},
{"InvalidInstructionExpression.q", &errors.InvalidInstruction{Instruction: "+"}},
{"InvalidInstructionCall.q", &errors.InvalidInstruction{Instruction: "sys.write"}},
{"InvalidInstructionExpression.q", &errors.InvalidInstruction{Instruction: "2+3"}},
{"InvalidInstructionIdentifier.q", &errors.InvalidInstruction{Instruction: "abc"}},
{"InvalidInstructionNumber.q", &errors.InvalidInstruction{Instruction: "123"}},
{"InvalidInstructionString.q", &errors.InvalidInstruction{Instruction: "\"Hello\""}},