Token refactor and better logs
This commit is contained in:
@@ -25,6 +25,10 @@ void assert_str(const char* expected, const char* actual, const char* msg) {
|
||||
}
|
||||
}
|
||||
|
||||
void assert_log(const char* expected, const char* msg) {
|
||||
assert_str(expected, s_logOutput, msg);
|
||||
}
|
||||
|
||||
static void log_append(const char* msg) {
|
||||
size_t oldLen = s_logOutput ? strlen(s_logOutput) : 0;
|
||||
size_t newLen = oldLen + strlen(msg) + 1;
|
||||
@@ -69,6 +73,7 @@ static TestCase s_tests[] = {
|
||||
{"tokenstream_info", test_tokenstream_info},
|
||||
{"parser_module_name", test_parser_module_name},
|
||||
{"log_error", test_log_error},
|
||||
{"log_on_line", test_log_on_line},
|
||||
};
|
||||
|
||||
|
||||
@@ -82,9 +87,8 @@ int main(int argc, char** argv) {
|
||||
const char* failedTests[s_totalTests + 1];
|
||||
int failedCount = 0;
|
||||
|
||||
log_set_output(log_append);
|
||||
|
||||
for (int i = 0; i < s_totalTests; i++) {
|
||||
log_set_output(log_append);
|
||||
printf("%s...", s_tests[i].name);
|
||||
s_failMsg = NULL;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user