Skip to content

test: cover remaining parser branches#47

Open
omsherikar wants to merge 1 commit intoarxlang:mainfrom
omsherikar:test/parser-issue-43
Open

test: cover remaining parser branches#47
omsherikar wants to merge 1 commit intoarxlang:mainfrom
omsherikar:test/parser-issue-43

Conversation

@omsherikar
Copy link
Copy Markdown
Contributor

@omsherikar omsherikar commented Apr 6, 2026

Exercise not_initialized token, module docstring rules, extern, primaries, and default var values .

Solves #43

Exercise not_initialized token, module docstring rules, extern, primaries, and default var values (issue arxlang#43).
Copilot AI review requested due to automatic review settings April 6, 2026 18:44
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Adds targeted tests to exercise previously uncovered/rare branches in src/arx/parser.py, improving parser coverage per issue #43.

Changes:

  • Strengthens the local _parse() test helper with an AST type assertion.
  • Adds parser branch tests for: leading not_initialized token handling, module docstring placement rules, top-level empty ; statements, extern prototypes, primary-expression edge cases, and default initializer values for typed var declarations without =.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines +346 to +347
token_list.position = 0
token_list.cur_tok = Token(TokenKind.not_initialized, "")
Copy link

Copilot AI Apr 6, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In test_parse_consumes_leading_not_initialized_token, resetting token_list.position and token_list.cur_tok is redundant (a freshly created TokenList from Lexer().lex() already starts at position 0 with cur_tok set to not_initialized), and mutating these internals makes the test more brittle than necessary. Consider removing these assignments and just prepend the not_initialized token (or build a new TokenList with the extra token) before calling Parser().parse().

Suggested change
token_list.position = 0
token_list.cur_tok = Token(TokenKind.not_initialized, "")

Copilot uses AI. Check for mistakes.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants