mirror of
https://gitlab.com/camelot/kickc.git
synced 2024-12-26 03:32:23 +00:00
Added a few more printf() error tests.
This commit is contained in:
parent
986ad3b77f
commit
4c3b000fbd
@ -40,6 +40,16 @@ public class TestPrograms {
|
||||
public TestPrograms() {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testPrintfError5() throws IOException, URISyntaxException {
|
||||
assertError("printf-error-5.c", "Error! printf() format parameter must be a string!");
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testPrintfError4() throws IOException, URISyntaxException {
|
||||
assertError("printf-error-4.c", "Error! Only constant printf() format parameter supported!");
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testPrintfError3() throws IOException, URISyntaxException {
|
||||
assertError("printf-error-3.c", "Error! If any single printf() placeholder specifies a parameter, all the rest of the placeholders must also specify a parameter!");
|
||||
|
12
src/test/kc/printf-error-4.c
Normal file
12
src/test/kc/printf-error-4.c
Normal file
@ -0,0 +1,12 @@
|
||||
// Tests printf function call rewriting
|
||||
// Non-constant format parameter
|
||||
|
||||
#include <printf.h>
|
||||
|
||||
void main() {
|
||||
char* fmt = "%d";
|
||||
printf(fmt, 1);
|
||||
fmt = "%hhx";
|
||||
printf(fmt, 1);
|
||||
}
|
||||
|
9
src/test/kc/printf-error-5.c
Normal file
9
src/test/kc/printf-error-5.c
Normal file
@ -0,0 +1,9 @@
|
||||
// Tests printf function call rewriting
|
||||
// Non-string format parameter
|
||||
|
||||
#include <printf.h>
|
||||
|
||||
void main() {
|
||||
printf(1, 1);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user