feat(update): add update by environment variable #1
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Added the second option to update a snapshot test with an environment variable very inspired by the original snapshot testing library from TigerBeetle (see tigerbeetle/tigerbeetle/blob/main/src/testing/snaptest.zig#L109-L112).
This option was, tested but a unit test is kind of useless in this case. The test included the update of the
CustomStruct
structure like shown in the code snippet below (first snippet before update, second commands, third after update):PS: I know the code is a little bit repetitive if you have an idea how make it look nicer I'm open for changes.
PPS: I know this is out of the blue. I looked at snapshot testing, then the blog entry from TigerBeetle, then thought I could outsource the snap lib from, them then saw your project and missed this feature while using it hope you like it. Like the idea of this project very much ❤️!