Skip to content

Add inline unit tests to new parser modules (sexpr.rs, classification.rs, delay.rs, diff.rs, postfix.rs) #262

@coderabbitai

Description

@coderabbitai

Background

PR #259 extracted logic from several oversized parser modules into five new focused modules. None of these modules currently carry inline unit tests; coverage relies entirely on integration-level expression-parser tests.

Affected modules

  • src/parser/ast/expr/sexpr.rs — S-expression rendering for Expr
  • src/parser/ast/rule/classification.rs — rule-body term classification pipeline
  • src/parser/expression/pratt/delay.rs — delay-postfix parsing (expr -<N>)
  • src/parser/expression/pratt/diff.rs — diff-marker postfix helpers
  • src/parser/expression/pratt/postfix.rs — postfix-operator dispatch chain

Required work

Add #[cfg(test)] modules with focused unit tests to each of the five files above. As a minimum, cover:

  • sexpr.rs: one test per Expr variant rendered by to_sexpr() asserting the expected S-expression string (pending migration to snapshot testing tracked in #261).
  • classification.rs: tests for parse_rule_body_term covering assignment splitting, for-loop classification, aggregation detection, duplicate-aggregation error, and the whitespace-only value edge case.
  • delay.rs: tests for parse_delay_postfix covering a valid delay, a missing delay value, an invalid (non-numeric) delay value, and a missing closing >.
  • diff.rs: tests for handle_diff_marker (single marker, duplicate marker), apply_pending_diff (pending set, pending absent), validate_diff_not_pending, and validate_no_pending_diff.
  • postfix.rs: tests for parse_postfix covering function-call, bit-slice, dot-access (field and tuple-index), method-call, diff-marker, and delay postfix forms.

References

Metadata

Metadata

Assignees

Labels

No labels
No labels

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions