mirror of
https://gitlab.com/camelot/kickc.git
synced 2024-11-25 20:32:25 +00:00
Added test of ranged for loop with an undeclared loop variable. Closes #333
This commit is contained in:
parent
802f72df99
commit
d9c387665c
@ -3373,6 +3373,11 @@ public class TestPrograms {
|
||||
compileAndCompare("examples/multiplexer/simple-multiplexer.c", 10);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testForRangedNpe() throws IOException, URISyntaxException {
|
||||
assertError("forranged-npe.c", "Error! Loop variable not declared i");
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testForRangedWords() throws IOException, URISyntaxException {
|
||||
compileAndCompare("forrangedwords.c");
|
||||
|
14
src/test/kc/forranged-npe.c
Normal file
14
src/test/kc/forranged-npe.c
Normal file
@ -0,0 +1,14 @@
|
||||
// Range-loop without loop variable declaration causes NPE
|
||||
// https://gitlab.com/camelot/kickc/-/issues/333
|
||||
|
||||
char * line = 0x0400;
|
||||
|
||||
void main() {
|
||||
clear_line(line);
|
||||
clear_line(line+40);
|
||||
}
|
||||
|
||||
void clear_line(byte *line) {
|
||||
for (i: 0..39)
|
||||
line[i] = 0;
|
||||
}
|
Loading…
Reference in New Issue
Block a user