Add some more tests, and fix some existing ones

This commit is contained in:
Rangi42
2024-08-09 22:41:20 -04:00
committed by Sylvie
parent ee3a93a442
commit 7cf4156003
17 changed files with 175 additions and 8 deletions

View File

@@ -1,2 +1,2 @@
SECTION "You lost the game", ROM0[17]
SECTION "You lost the game", ROM0, ALIGN[17, 99]
ALIGN 17, 99

5
test/asm/align-large.err Normal file
View File

@@ -0,0 +1,5 @@
error: align-large.asm(1):
Alignment must be between 0 and 16, not 17
error: align-large.asm(2):
Alignment must be between 0 and 16, not 17
error: Assembly aborted (2 errors)!

3
test/asm/const-not.asm Normal file
View File

@@ -0,0 +1,3 @@
section "test", rom0, align[8]
ds 42
assert !@

3
test/asm/const-not.err Normal file
View File

@@ -0,0 +1,3 @@
error: const-not.asm(3):
Assertion failed
error: Assembly aborted (1 error)!

View File

@@ -0,0 +1,3 @@
def n equ 42
purge n
purge n

View File

@@ -0,0 +1,3 @@
error: double-purge.asm(3):
'n' was already purged
error: Assembly aborted (1 error)!

View File

@@ -1,7 +1,11 @@
opt b123
opt g12345
opt pxy
opt p1234
opt Qxy
opt Q1234
opt Q32
opt r99999999999999999999999999
opt W
opt
popo

View File

@@ -5,11 +5,19 @@ error: invalid-opt.asm(2):
error: invalid-opt.asm(3):
Invalid argument for option 'p'
error: invalid-opt.asm(4):
Invalid argument for option 'Q'
Invalid argument for option 'p'
error: invalid-opt.asm(5):
Argument for option 'Q' must be between 1 and 31
Invalid argument for option 'Q'
error: invalid-opt.asm(6):
Must specify an argument for option 'W'
Invalid argument for option 'Q'
error: invalid-opt.asm(7):
Argument for option 'Q' must be between 1 and 31
error: invalid-opt.asm(8):
Argument to 'r' is out of range ("99999999999999999999999999")
error: invalid-opt.asm(9):
Must specify an argument for option 'W'
error: invalid-opt.asm(10):
syntax error, unexpected newline, expecting string
error: Assembly aborted (7 errors)!
error: invalid-opt.asm(11):
No entries in the option stack
error: Assembly aborted (11 errors)!

View File

@@ -8,8 +8,7 @@ SECTION "Output", ROM0[0]
SECTION "ROM CODE",ROM0
ds $80
LOAD "RAM CODE",SRAM
PUSHS
SECTION "HRAM",HRAM
PUSHS "HRAM",HRAM
ds 1
POPS
ENDL

View File

@@ -0,0 +1,26 @@
SECTION "test", ROM0
MACRO m
ENDM
PURGE m
m
DEF argi EQU 1
MACRO m2
println "(\<argi>)!"
ENDM
PURGE argi
m2 hello
DEF n EQU argi
PRINTLN "({argi})"
Label::
PURGE Label
DEF x = Label
DEF x = BANK(Label)
Label2::
PURGE Label2
DEF x EQUS SECTION(Label2) ; fatal

View File

@@ -0,0 +1,18 @@
error: use-purged-symbol.asm(6):
Macro "m" not defined; it was purged
error: use-purged-symbol.asm(13) -> use-purged-symbol.asm::m2(10):
Bracketed symbol "argi" does not exist; it was purged
error: use-purged-symbol.asm(15):
Expected constant expression: 'argi' is not constant at assembly time; it was purged
error: use-purged-symbol.asm(17):
Interpolated symbol "argi" does not exist; it was purged
warning: use-purged-symbol.asm(20): [-Wpurge]
Purging an exported symbol "Label"
error: use-purged-symbol.asm(21):
Expected constant expression: 'Label' is not constant at assembly time; it was purged
error: use-purged-symbol.asm(22):
Expected constant expression: "Label"'s bank is not known; it was purged
warning: use-purged-symbol.asm(25): [-Wpurge]
Purging an exported symbol "Label2"
FATAL: use-purged-symbol.asm(26):
Unknown symbol "Label2"; it was purged

View File

@@ -0,0 +1,2 @@
()!
()