Add more test cases for IF, REPT, and MACRO (#748)

This commit is contained in:
Rangi
2021-02-19 16:34:21 -08:00
committed by GitHub
parent bee62076c6
commit a6d844a9a5
6 changed files with 67 additions and 0 deletions

View File

@@ -0,0 +1,27 @@
println "start"
; will not define 'mac'
mac: MACRO
println \1
ENDM println "<_<"
mac "argument"
; will not repeat
REPT 3
println "hey!"
ENDR println "<_<"
IF 0
println "skipped"
bad syntax!?
ELSE println "<_<"
println "else clause"
ENDC println "<_<"
IF 1
println "if clause"
ELSE println "<_<"
println "not skipped"
ENDC println "<_<"
println "done"

View File

@@ -0,0 +1,15 @@
ERROR: code-after-endm-endr-endc.asm(6):
syntax error, unexpected PRINTLN, expecting newline
ERROR: code-after-endm-endr-endc.asm(7):
Macro "mac" not defined
ERROR: code-after-endm-endr-endc.asm(12):
syntax error, unexpected PRINTLN, expecting newline
ERROR: code-after-endm-endr-endc.asm(17):
syntax error, unexpected PRINTLN, expecting newline
ERROR: code-after-endm-endr-endc.asm(19):
syntax error, unexpected PRINTLN, expecting end of file or newline
ERROR: code-after-endm-endr-endc.asm(23):
syntax error, unexpected PRINTLN, expecting newline
ERROR: code-after-endm-endr-endc.asm(25):
syntax error, unexpected PRINTLN, expecting end of file or newline
error: Assembly aborted (7 errors)!

View File

@@ -0,0 +1,5 @@
start
else clause
if clause
not skipped
done

View File

@@ -0,0 +1,18 @@
if 0
println "zero"
else
println "one"
if 1
println "A"
else
println "B"
else
println "C"
else
println "D"
endc
else
println "two"
else
println "three"
endc

View File

View File

@@ -0,0 +1,2 @@
one
A