Skip to content

Introduce snapshot testing for Expr::to_sexpr() in sexpr.rs #261

@coderabbitai

Description

@coderabbitai

Background

PR #259 extracted Expr::to_sexpr() into src/parser/ast/expr/sexpr.rs. The output is a text-based S-expression representation used in parser tests. Currently this output is validated only by inline string assertions; there are no snapshot tests to guard the rendering against regression.

Required work

Introduce snapshot testing for src/parser/ast/expr/sexpr.rs using the insta crate:

  1. Add insta as a dev-dependency in Cargo.toml.
  2. Write snapshot tests covering each Expr variant rendered by to_sexpr(), using insta::assert_snapshot!.
  3. Commit the generated .snap files under src/parser/ast/expr/snapshots/ (or the default insta snapshot directory).
  4. Confirm cargo test and cargo insta review pass cleanly.

Rationale

Snapshot tests make regressions in S-expression output immediately visible as diff noise in review, rather than requiring manual comparison of string literals scattered across test functions.

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