Closed michaelkirk closed 8 months ago
I think we should start using https://insta.rs/docs/quickstart/ instead :) Much much much easier for all sorts of unit/integration testing
So you want to get started with snapshot testing? Here is the 5 minute introduction to how to be successful with insta.
I don't know what insta is, but looking briefly at the website I don't understand what this has to do with this pull request?
@michaelkirk the reason your PR is failing is because there is an assert in the code, validating code response against a hardcoded expected value. insta
is an amazing system for managing those expected values - so you can either run cargo test
and it will pass/fail, or you can cargo insta review
- where you can "bless" new expected values interactively. The actual expected values are stored in a separate snapshot folder managed by the insta too.
P.S. this was more of a general idea rather than a specific suggestion to this PR
Oh I see. I don't think the challenge of copy/pasting a new string was the issue in this case.
Now, if there is some sort of fancy rust crate that will slap me in the face whenever I forget to set up my per-project git hooks, I will cargo install
it so fast.
@michaelkirk you are in luck... Create a .cargo-husky/hooks/pre-push
file and add this to Cargo.toml:
[dev-dependencies]
cargo-husky = { version = "1", features = ["user-hooks"], default-features = false }
An example of it: https://github.com/nyurik/automotive_diag/blob/main/.cargo-husky/hooks/pre-push
I think we should start using https://insta.rs/docs/quickstart/ instead :) Much much much easier for all sorts of unit/integration testing
I also think that Insta is a great fit for geometry testing. It came out only a little too late for geozero. Maybe we can start using it when adding a new driver?
Before: Processing failed: I/O error
After: Processing failed: I/O error
No such file or directory (os error 2)