Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Migration towards snapshot-based testing #661

Open
bobbbay opened this issue Jul 23, 2022 · 1 comment
Open

Migration towards snapshot-based testing #661

bobbbay opened this issue Jul 23, 2022 · 1 comment

Comments

@bobbbay
Copy link
Contributor

bobbbay commented Jul 23, 2022

From the cargo-insta documentation,

Snapshots tests (also sometimes called approval tests) are tests that assert values against a reference value (the snapshot). This is similar to how assert_eq! lets you compare a value against a reference value but unlike simple string assertions, snapshot tests let you test against complex values and come with comprehensive tools to review changes.
Snapshot tests are particularly useful if your reference values are very large or change often.

In pest, the reference values are indeed quite large, and change relatively often.

By far, the most popular snapshot-based testing library is cargo-insta, but RA's expect-test also exists.

I do not have the permissions to add labels to this issue, but some labels I would like are good-first-issue and help-wanted.

@CAD97
Copy link
Contributor

CAD97 commented Jul 25, 2022

Other potentially useful tools include

  • trybuild: snapshot style testing for error messages
  • macrotest: snapshot style testing for macro expansions

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants