mirror of
https://github.com/gbdev/rgbds.git
synced 2025-11-20 10:12:06 +00:00
Add more test coverage
This commit is contained in:
@@ -47,7 +47,9 @@ void act_Elif(int32_t condition) {
|
|||||||
if (lexer_ReachedELSEBlock()) {
|
if (lexer_ReachedELSEBlock()) {
|
||||||
fatal("Found `ELIF` after an `ELSE` block");
|
fatal("Found `ELIF` after an `ELSE` block");
|
||||||
}
|
}
|
||||||
lexer_SetMode(LEXER_SKIP_TO_ENDC);
|
// This should be redundant, as the lexer will have skipped to `ENDC` since
|
||||||
|
// an `ELIF` after a taken `IF` needs to not evaluate its condition.
|
||||||
|
lexer_SetMode(LEXER_SKIP_TO_ENDC); // LCOV_EXCL_LINE
|
||||||
} else if (condition) {
|
} else if (condition) {
|
||||||
lexer_RunIFBlock();
|
lexer_RunIFBlock();
|
||||||
} else {
|
} else {
|
||||||
@@ -61,7 +63,8 @@ void act_Else() {
|
|||||||
}
|
}
|
||||||
if (lexer_RanIFBlock()) {
|
if (lexer_RanIFBlock()) {
|
||||||
if (lexer_ReachedELSEBlock()) {
|
if (lexer_ReachedELSEBlock()) {
|
||||||
fatal("Found `ELSE` after an `ELSE` block");
|
// This should be redundant, as the lexer handles this error first.
|
||||||
|
fatal("Found `ELSE` after an `ELSE` block"); // LCOV_EXCL_LINE
|
||||||
}
|
}
|
||||||
lexer_SetMode(LEXER_SKIP_TO_ENDC);
|
lexer_SetMode(LEXER_SKIP_TO_ENDC);
|
||||||
} else {
|
} else {
|
||||||
|
|||||||
@@ -406,13 +406,16 @@ static Section *getSection(
|
|||||||
bank = sectionTypeInfo[type].firstBank;
|
bank = sectionTypeInfo[type].firstBank;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// This should be redundant, as the parser guarantees that `AlignmentSpec` will be valid.
|
||||||
if (alignOffset >= alignSize) {
|
if (alignOffset >= alignSize) {
|
||||||
|
// LCOV_EXCL_START
|
||||||
error(
|
error(
|
||||||
"Alignment offset (%" PRIu16 ") must be smaller than alignment size (%" PRIu32 ")",
|
"Alignment offset (%" PRIu16 ") must be smaller than alignment size (%" PRIu32 ")",
|
||||||
alignOffset,
|
alignOffset,
|
||||||
alignSize
|
alignSize
|
||||||
);
|
);
|
||||||
alignOffset = 0;
|
alignOffset = 0;
|
||||||
|
// LCOV_EXCL_STOP
|
||||||
}
|
}
|
||||||
|
|
||||||
if (org != UINT32_MAX) {
|
if (org != UINT32_MAX) {
|
||||||
|
|||||||
2
test/asm/fragment-align-mismatch.asm
Normal file
2
test/asm/fragment-align-mismatch.asm
Normal file
@@ -0,0 +1,2 @@
|
|||||||
|
section fragment "aligned", wram0[$c002], align[1]
|
||||||
|
section fragment "aligned", wram0, align[2]
|
||||||
4
test/asm/fragment-align-mismatch.err
Normal file
4
test/asm/fragment-align-mismatch.err
Normal file
@@ -0,0 +1,4 @@
|
|||||||
|
error: Section already declared as fixed at incompatible address $c002
|
||||||
|
at fragment-align-mismatch.asm(2)
|
||||||
|
FATAL: Cannot create section "aligned" (1 error)
|
||||||
|
at fragment-align-mismatch.asm(2)
|
||||||
1
test/asm/fragment-literal-outside-section.asm
Normal file
1
test/asm/fragment-literal-outside-section.asm
Normal file
@@ -0,0 +1 @@
|
|||||||
|
dw [[ db 42 ]]
|
||||||
2
test/asm/fragment-literal-outside-section.err
Normal file
2
test/asm/fragment-literal-outside-section.err
Normal file
@@ -0,0 +1,2 @@
|
|||||||
|
FATAL: Cannot output fragment literals outside of a `SECTION`
|
||||||
|
at fragment-literal-outside-section.asm(1)
|
||||||
@@ -25,6 +25,7 @@ println 0b101010_
|
|||||||
println 0o123456_
|
println 0o123456_
|
||||||
println 0xabcdef_
|
println 0xabcdef_
|
||||||
println `01230123_
|
println `01230123_
|
||||||
|
println 123.456_
|
||||||
|
|
||||||
; bad ('_' next to '.')
|
; bad ('_' next to '.')
|
||||||
println 1_.618
|
println 1_.618
|
||||||
|
|||||||
@@ -22,8 +22,10 @@ error: Invalid integer constant, trailing '_'
|
|||||||
at invalid-underscore.asm(26)
|
at invalid-underscore.asm(26)
|
||||||
error: Invalid graphics constant, trailing '_'
|
error: Invalid graphics constant, trailing '_'
|
||||||
at invalid-underscore.asm(27)
|
at invalid-underscore.asm(27)
|
||||||
|
error: Invalid fixed-point constant, trailing '_'
|
||||||
|
at invalid-underscore.asm(28)
|
||||||
error: Invalid integer constant, trailing '_'
|
error: Invalid integer constant, trailing '_'
|
||||||
at invalid-underscore.asm(30)
|
|
||||||
error: Invalid integer constant, '_' after another '_'
|
|
||||||
at invalid-underscore.asm(31)
|
at invalid-underscore.asm(31)
|
||||||
Assembly aborted with 14 errors!
|
error: Invalid integer constant, '_' after another '_'
|
||||||
|
at invalid-underscore.asm(32)
|
||||||
|
Assembly aborted with 15 errors!
|
||||||
|
|||||||
@@ -20,5 +20,6 @@ $2A
|
|||||||
$A72E
|
$A72E
|
||||||
$ABCDEF
|
$ABCDEF
|
||||||
$3355
|
$3355
|
||||||
|
$7B74BC
|
||||||
$19E35
|
$19E35
|
||||||
$2B7CF
|
$2B7CF
|
||||||
|
|||||||
1
test/asm/section-align-large-ofs.asm
Normal file
1
test/asm/section-align-large-ofs.asm
Normal file
@@ -0,0 +1 @@
|
|||||||
|
section "test", rom0, align[2, 99]
|
||||||
3
test/asm/section-align-large-ofs.err
Normal file
3
test/asm/section-align-large-ofs.err
Normal file
@@ -0,0 +1,3 @@
|
|||||||
|
error: The absolute alignment offset (99) must be less than alignment size (4)
|
||||||
|
at section-align-large-ofs.asm(1)
|
||||||
|
Assembly aborted with 1 error!
|
||||||
2
test/asm/union-mismatch.asm
Normal file
2
test/asm/union-mismatch.asm
Normal file
@@ -0,0 +1,2 @@
|
|||||||
|
section union "fixed", wram0[$c001]
|
||||||
|
section union "fixed", wram0, align[1]
|
||||||
4
test/asm/union-mismatch.err
Normal file
4
test/asm/union-mismatch.err
Normal file
@@ -0,0 +1,4 @@
|
|||||||
|
error: Section already declared as fixed at incompatible address $c001
|
||||||
|
at union-mismatch.asm(2)
|
||||||
|
FATAL: Cannot create section "fixed" (1 error)
|
||||||
|
at union-mismatch.asm(2)
|
||||||
Reference in New Issue
Block a user