diff options
| author | hachem <im@hachem.wtf> | 2026-08-30 17:50:49 +0200 |
|---|---|---|
| committer | hachem <im@hachem.wtf> | 2026-08-30 17:50:49 +0200 |
| commit | 542e15041ea1d93e74a06c588f16ce7956d6a9bb (patch) | |
| tree | 3dda2b5c2b1b5f4d572a837bec879635371c0a20 /tests/parser_test.c | |
| parent | a07b22097f3758558f4b35aa5aa5d8c1afc3402b (diff) | |
add: parse stack directive
Diffstat (limited to 'tests/parser_test.c')
| -rw-r--r-- | tests/parser_test.c | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/tests/parser_test.c b/tests/parser_test.c index 8e72402..bbbbaa2 100644 --- a/tests/parser_test.c +++ b/tests/parser_test.c @@ -172,6 +172,22 @@ static void test_parse_call(struct TestContext* context) free_program(&program); } +static void test_parse_stack(struct TestContext* context) +{ + struct Lexer lexer = create_lexer("proc main\n{\nstack buffer[32]\n}\n"); + struct Program program; + + check(context, parse_program(&lexer, &program)); + check(context, program.procs[0].body_count == 1); + + struct Statement statement = program.procs[0].body[0]; + check(context, statement.kind == STATEMENT_STACK); + check(context, text_is(statement.stack.name, "buffer")); + check(context, text_is(statement.stack.size, "32")); + + free_program(&program); +} + static void test_parse_errors(struct TestContext* context) { struct Program program; @@ -199,5 +215,6 @@ void run_parser_tests(struct TestContext* context) test_parse_expressions(context); test_parse_if(context); test_parse_call(context); + test_parse_stack(context); test_parse_errors(context); } |
