mirror of
https://github.com/Ed94/metadesk.git
synced 2026-08-04 06:38:45 +00:00
string generation feature options + implementations + tests
This commit is contained in:
@@ -898,5 +898,33 @@ int main(void)
|
||||
}
|
||||
}
|
||||
|
||||
Test("Debug Strings")
|
||||
{
|
||||
{
|
||||
MD_String8 code = MD_S8Lit("@foo @bar @baz a: { b c d e f }");
|
||||
MD_String8 expected = MD_S8Lit("@foo\n@bar\n@baz\na:\n{\n b,\n c,\n d,\n e,\n f,\n}");
|
||||
MD_ParseResult parse = MD_ParseOneNode(arena, code, 0);
|
||||
MD_String8List actual_strings = MD_DebugStringListFromNode(arena, parse.node, 0, MD_S8Lit(" "), MD_GenerateFlags_Tree);
|
||||
MD_String8 actual = MD_S8ListJoin(arena, actual_strings, 0);
|
||||
TestResult(MD_S8Match(expected, actual, 0));
|
||||
}
|
||||
{
|
||||
MD_String8 code = MD_S8Lit("@foo(1, 2, 3) a: { x y }");
|
||||
MD_String8 expected = MD_S8Lit("@foo(1,\n 2,\n 3)\na:\n{\n x,\n y,\n}");
|
||||
MD_ParseResult parse = MD_ParseOneNode(arena, code, 0);
|
||||
MD_String8List actual_strings = MD_DebugStringListFromNode(arena, parse.node, 0, MD_S8Lit(" "), MD_GenerateFlags_Tree);
|
||||
MD_String8 actual = MD_S8ListJoin(arena, actual_strings, 0);
|
||||
TestResult(MD_S8Match(expected, actual, 0));
|
||||
}
|
||||
{
|
||||
MD_String8 code = MD_S8Lit("// foo\na");
|
||||
MD_String8 expected = MD_S8Lit("/*\n foo\n*/\na");
|
||||
MD_ParseResult parse = MD_ParseOneNode(arena, code, 0);
|
||||
MD_String8List actual_strings = MD_DebugStringListFromNode(arena, parse.node, 0, MD_S8Lit(" "), MD_GenerateFlags_Tree|MD_GenerateFlag_Comments);
|
||||
MD_String8 actual = MD_S8ListJoin(arena, actual_strings, 0);
|
||||
TestResult(MD_S8Match(expected, actual, 0));
|
||||
}
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user