Split test

This commit is contained in:
2026-04-24 20:41:57 +02:00
parent 0306530fe8
commit 9ca72ef5bf
2 changed files with 5 additions and 4 deletions
+1
View File
@@ -75,6 +75,7 @@ static TestCase s_tests[] = {
{"parser_module_name", test_parser_module_name}, {"parser_module_name", test_parser_module_name},
{"log_error", test_log_error}, {"log_error", test_log_error},
{"log_on_line", test_log_on_line}, {"log_on_line", test_log_on_line},
{"log_on_line_format", test_log_on_line_format},
}; };
+4 -4
View File
@@ -28,16 +28,16 @@ static void test_log_on_line(void) {
" unexpected token\n"; " unexpected token\n";
log_on_line("test.c", "int main() []", 1, 12, 13, "unexpected token"); log_on_line("test.c", "int main() []", 1, 12, 13, "unexpected token");
assert_log(expected, "expected formatted error message"); assert_log(expected, "expected formatted error message");
}
log_clear(); static void test_log_on_line_format(void) {
const char* expected2 = const char* expected =
"--- test.c ---\n" "--- test.c ---\n"
"1| int main() []\n" "1| int main() []\n"
" ^^\n" " ^^\n"
" unexpected token 'x'\n"; " unexpected token 'x'\n";
log_on_line("test.c", "int main() []", 1, 12, 13, "unexpected token '%c'", 'x'); log_on_line("test.c", "int main() []", 1, 12, 13, "unexpected token '%c'", 'x');
assert_log(expected2, "expected formatted error message with variadic args"); assert_log(expected, "expected formatted error message with variadic args");
} }