Update log_on_line to take Location* instead of individual fields
This commit is contained in:
+10
-2
@@ -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");
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user