Update log_on_line to take Location* instead of individual fields

This commit is contained in:
2026-04-24 22:13:29 +02:00
parent 26a1d0285e
commit 902e2f0325
4 changed files with 25 additions and 18 deletions
+10 -2
View File
@@ -21,10 +21,18 @@ static void test_log_error(void) {
}
static void test_log_on_line(void) {
log_on_line("test.c", "int main() []", 1, 12, 13, "unexpected token");
Location loc = {
.filename = "test.c",
.line_text = "int main() []",
.line_text_length = 13,
.line = 1,
.column = 12
};
log_on_line(&loc, 13, "unexpected token");
assert_log_file("v0/tests/log_on_line.txt", "expected formatted error message");
log_clear();
log_on_line("test.c", "int main() []", 1, 12, 13, "unexpected token '%c'", 'x');
log_on_line(&loc, 13, "unexpected token '%c'", 'x');
assert_log_file("v0/tests/log_on_line_variadic.txt", "expected formatted error message with variadic args");
}