-
-
Couldn't load subscription status.
- Fork 8
Open
Labels
enhancementNew feature or requestNew feature or request
Description
🚀 Feature Proposal
cargo insta has this very cool feature called inline snapshots. When a snapshot updates, it updates the code itself. How hard would this be to implement in Go?
It could be based on some //go: marker above the check, possibly? And maybe it would need to be an option in TestMain.
Motivation
Seeing, inline, the expected values of unit tests instead of hopping between files and scanning multiple lines of output.
Example
Not sure yet, perhaps using //go:generate? The crazy part is Rust somehow generates the code inside the file, rather than writing a new file. I'm not sure if this breaks certain Go workflows.
// before compilation
// `snapshot-inline`, or some marker, tells the codegen where to inject
// snapshot-inline
snaps.MatchSnapshot(t, rr.Code, "")// after compilation
// snapshot-inline
snaps.MatchSnapshot(t, rr.Code, 201)Metadata
Metadata
Assignees
Labels
enhancementNew feature or requestNew feature or request