feat: hectic C: prettify debug strings

This commit is contained in:
2025-04-15 15:53:39 +00:00
parent ba6ec7a113
commit 6b8e825a4b
5 changed files with 153 additions and 27 deletions

View File

@@ -33,6 +33,16 @@ static void test_template_node_to_debug_str(Arena *arena) {
char *debug_str = TEMPLATE_NODE_TO_DEBUG_STR(arena, "root", root);
raise_notice("debug_str: %s", debug_str);
char *expected;
//sprintf(expected, "struct TemplateNode root = {enum type = TEXT 0, union TemplateValue value = {struct TemplateTextValue text = {content = %p \"Hello\"} %p} %p, struct TemplateNode children = NULL, struct TemplateNode next = {enum type = INTERPOLATE 1, union TemplateValue value = {struct TemplateInterpolateValue interpolate = {key = %p \"name\"} %p} %p, struct TemplateNode children = NULL, struct TemplateNode next = {enum type = TEXT 0, union TemplateValue value = {struct TemplateTextValue text = {content = %p \"!\"} %p} %p, struct TemplateNode children = NULL, struct TemplateNode next = NULL} %p} %p} %p",
// root.value.text.content,
// root.value.text,
// root.value,
// root.next.value.interpolate.key,
// root.next.value.interpolate,
// root.next.value,
//assert(strcmp(
// remove_all_spaces(debug_str),
// remove_all_spaces(""