mirror of
https://github.com/Ed94/metadesk.git
synced 2026-06-13 07:52:22 -07:00
node comment bugfixes and tests
This commit is contained in:
@@ -1129,9 +1129,6 @@ MD_Parse_LexNext(MD_ParseCtx *ctx)
|
||||
}
|
||||
}
|
||||
|
||||
// NOTE(rjf): Trim off newline always.
|
||||
chop_n = 1;
|
||||
|
||||
at += 2;
|
||||
token.kind = MD_TokenKind_Comment;
|
||||
MD_TokenizerScan(*at != '\n');
|
||||
|
||||
+44
-4
@@ -401,10 +401,50 @@ int main(void)
|
||||
|
||||
Test("Node Comments")
|
||||
{
|
||||
MD_ParseResult parse = MD_ParseOneNode(MD_S8Lit(""), MD_S8Lit("/*foobar*/ (a b c)"));
|
||||
fprintf(stderr, "\n\"%.*s\"\n", MD_StringExpand(parse.node->comment_before));
|
||||
TestResult(parse.node->kind == MD_NodeKind_Label &&
|
||||
MD_StringMatch(parse.node->comment_before, MD_S8Lit("foobar"), 0));
|
||||
|
||||
// NOTE(rjf): Pre-Comments:
|
||||
{
|
||||
{
|
||||
MD_ParseResult parse = MD_ParseOneNode(MD_S8Lit(""), MD_S8Lit("/*foobar*/ (a b c)"));
|
||||
TestResult(parse.node->kind == MD_NodeKind_Label &&
|
||||
MD_StringMatch(parse.node->comment_before, MD_S8Lit("foobar"), 0));
|
||||
}
|
||||
{
|
||||
MD_ParseResult parse = MD_ParseOneNode(MD_S8Lit(""), MD_S8Lit("// foobar\n(a b c)"));
|
||||
TestResult(parse.node->kind == MD_NodeKind_Label &&
|
||||
MD_StringMatch(parse.node->comment_before, MD_S8Lit("foobar"), 0));
|
||||
}
|
||||
{
|
||||
MD_ParseResult parse = MD_ParseOneNode(MD_S8Lit(""), MD_S8Lit("// foobar\n\n(a b c)"));
|
||||
TestResult(parse.node->kind == MD_NodeKind_Label &&
|
||||
MD_StringMatch(parse.node->comment_before, MD_S8Lit(""), 0));
|
||||
}
|
||||
}
|
||||
|
||||
// NOTE(rjf): Post-Comments:
|
||||
{
|
||||
{
|
||||
MD_ParseResult parse = MD_ParseOneNode(MD_S8Lit(""), MD_S8Lit("(a b c) /*foobar*/"));
|
||||
TestResult(parse.node->kind == MD_NodeKind_Label &&
|
||||
MD_StringMatch(parse.node->comment_after, MD_S8Lit("foobar"), 0));
|
||||
}
|
||||
{
|
||||
MD_ParseResult parse = MD_ParseOneNode(MD_S8Lit(""), MD_S8Lit("(a b c) // foobar"));
|
||||
TestResult(parse.node->kind == MD_NodeKind_Label &&
|
||||
MD_StringMatch(parse.node->comment_after, MD_S8Lit("foobar"), 0));
|
||||
}
|
||||
{
|
||||
MD_ParseResult parse = MD_ParseOneNode(MD_S8Lit(""), MD_S8Lit("(a b c)\n// foobar"));
|
||||
TestResult(parse.node->kind == MD_NodeKind_Label &&
|
||||
MD_StringMatch(parse.node->comment_after, MD_S8Lit(""), 0));
|
||||
}
|
||||
{
|
||||
MD_ParseResult parse = MD_ParseOneNode(MD_S8Lit(""), MD_S8Lit("(a b c)\n\n// foobar"));
|
||||
TestResult(parse.node->kind == MD_NodeKind_Label &&
|
||||
MD_StringMatch(parse.node->comment_after, MD_S8Lit(""), 0));
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
return 0;
|
||||
|
||||
Reference in New Issue
Block a user