diff --git a/v0/test.c b/v0/test.c index ef52077..e317795 100644 --- a/v0/test.c +++ b/v0/test.c @@ -75,6 +75,7 @@ static TestCase s_tests[] = { {"parser_module_name", test_parser_module_name}, {"log_error", test_log_error}, {"log_on_line", test_log_on_line}, + {"log_on_line_format", test_log_on_line_format}, }; diff --git a/v0/test_log.c b/v0/test_log.c index 18acc42..b690330 100644 --- a/v0/test_log.c +++ b/v0/test_log.c @@ -28,16 +28,16 @@ static void test_log_on_line(void) { " unexpected token\n"; log_on_line("test.c", "int main() []", 1, 12, 13, "unexpected token"); - assert_log(expected, "expected formatted error message"); +} - log_clear(); - const char* expected2 = +static void test_log_on_line_format(void) { + const char* expected = "--- test.c ---\n" "1| int main() []\n" " ^^\n" " unexpected token 'x'\n"; 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"); } \ No newline at end of file