Implement tokenstream_get_test and simplified assert_log_file using test names
This commit is contained in:
+15
-6
@@ -22,7 +22,7 @@ static void test_log_error(void) {
|
||||
|
||||
static void test_log_on_line(void) {
|
||||
Location loc = {
|
||||
.filename = "test.c",
|
||||
.filename = "v0/tests/log_on_line.c2",
|
||||
.line_text = { "int main() []", 13 },
|
||||
.line = 1,
|
||||
.column_start = 12,
|
||||
@@ -30,9 +30,18 @@ static void test_log_on_line(void) {
|
||||
};
|
||||
|
||||
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(&loc, 13, "unexpected token '%c'", 'x');
|
||||
assert_log_file("v0/tests/log_on_line_variadic.txt", "expected formatted error message with variadic args");
|
||||
assert_log_file("expected formatted error message");
|
||||
}
|
||||
|
||||
static void test_log_on_line_variadic(void) {
|
||||
Location loc = {
|
||||
.filename = "v0/tests/log_on_line_variadic.c2",
|
||||
.line_text = { "int main() []", 13 },
|
||||
.line = 1,
|
||||
.column_start = 12,
|
||||
.column_end = 13
|
||||
};
|
||||
|
||||
log_on_line(&loc, 13, "unexpected token '%c'", 'x');
|
||||
assert_log_file("expected formatted error message with variadic args");
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user