diff options
| author | hachem <im@hachem.wtf> | 2026-09-09 05:14:44 +0200 |
|---|---|---|
| committer | hachem <im@hachem.wtf> | 2026-09-09 05:14:44 +0200 |
| commit | 8b76d35b0a045e0a3277be422513b938ef33dcce (patch) | |
| tree | b876d92ba3afb810e38f3f83792fc3fb849dd457 /tests/parser_test.c | |
| parent | b9eff51ee157b22d8fa46aeecac7b95d5ed345d9 (diff) | |
feat: fasm backend
Diffstat (limited to 'tests/parser_test.c')
| -rw-r--r-- | tests/parser_test.c | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/tests/parser_test.c b/tests/parser_test.c index 88e32a1..a88a319 100644 --- a/tests/parser_test.c +++ b/tests/parser_test.c @@ -241,6 +241,23 @@ static void test_parse_while(struct TestContext* context) check(context, primary_is(loop.loop.right, "0")); check(context, loop.loop.body_count == 2); check(context, text_is(loop.loop.body[1].assign.target, "rcx")); + check(context, !loop.loop.named); + + free_program(&program); +} + +static void test_parse_while_named(struct TestContext* context) +{ + struct Lexer lexer = create_lexer("proc main\n{\nwhile .drain rcx > 0\n{\nrcx -= 1\n}\n}\n"); + struct Program program; + + check(context, parse_program(&lexer, &program)); + + struct Statement loop = program.procs[0].body[0]; + check(context, loop.kind == STATEMENT_WHILE); + check(context, loop.loop.named); + check(context, text_is(loop.loop.name, "drain")); + check(context, primary_is(loop.loop.left, "rcx")); free_program(&program); } @@ -417,6 +434,7 @@ void run_parser_tests(struct TestContext* context) test_parse_if_block(context); test_parse_else_if(context); test_parse_while(context); + test_parse_while_named(context); test_parse_call(context); test_parse_stack(context); test_parse_sized_deref(context); |
