mirror of
https://gitlab.com/camelot/kickc.git
synced 2024-12-28 16:31:36 +00:00
Added test for til parameter type problem. #299
This commit is contained in:
parent
f9a7904acb
commit
70aaeafecc
@ -36,6 +36,14 @@ public class TestPrograms {
|
||||
public TestPrograms() {
|
||||
}
|
||||
|
||||
// Fix parameter type problem - https://gitlab.com/camelot/kickc/issues/299
|
||||
/*
|
||||
@Test
|
||||
public void testParameterAutocastWrong() throws IOException, URISyntaxException {
|
||||
compileAndCompare("parameter-autocast-wrong");
|
||||
}
|
||||
*/
|
||||
|
||||
@Test
|
||||
public void testKickasmUsesPreventDeletion() throws IOException, URISyntaxException {
|
||||
compileAndCompare("kickasm-uses-prevent-deletion");
|
||||
|
15
src/test/kc/parameter-autocast-wrong.kc
Normal file
15
src/test/kc/parameter-autocast-wrong.kc
Normal file
@ -0,0 +1,15 @@
|
||||
// Illustrates problem with wrong autocasting of parameters
|
||||
// Program wrongly reports Unknown fragment error - while it should have reported type problem (char != char*)
|
||||
|
||||
char[] message = "CHAO0029 OPERATING SYSTEM STARTING...";
|
||||
|
||||
void main() {
|
||||
print_to_screen(*message); // Passes *(char*) - effectively char to function that takes char*
|
||||
}
|
||||
|
||||
char* screen = 0x0400;
|
||||
|
||||
void print_to_screen(char *message) {
|
||||
while(*message)
|
||||
*screen++ = *message++;
|
||||
}
|
Loading…
Reference in New Issue
Block a user