1
0
mirror of https://gitlab.com/camelot/kickc.git synced 2024-09-08 17:54:40 +00:00

Added another test securing that undefined variables cannot be used even if fwd-refs are allowed.

This commit is contained in:
Jesper Gravgaard 2018-04-22 12:22:48 +02:00
parent c8edee4291
commit 4640b31043
2 changed files with 14 additions and 0 deletions

View File

@ -635,6 +635,11 @@ public class TestPrograms {
assertError("useuninitialized", "Variable used before being defined");
}
@Test
public void testUseUninitialized2() throws IOException, URISyntaxException {
assertError("useuninitialized2", "Variable used before being defined");
}
@Test
public void testTypeMismatch() throws IOException, URISyntaxException {
assertError("typemismatch", "Type mismatch");

View File

@ -0,0 +1,9 @@
// Test that forward-referencing an uninitialized variable inside a method fails.
void main() {
const byte b = a;
const byte a = 'c';
byte* screen = $400;
screen[0] = a;
screen[1] = b;
}