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

Add section on binary snapshots #28

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 17 additions & 0 deletions content/docs/snapshot-types.md
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,23 @@ accept the change. The file will then be updated automatically and the
reference value will be placed in the macro invocation. Note that inline
snapshots require the use of `cargo-insta`.

## Binary snapshots (experimental)

Binary snapshots store their content in a separate file next to the metadata
file. This enables opening them in external tools. They are simply compared byte
for byte.

```rust
#[test]
fn test_something() {
// implicit name:
insta::assert_binary_snapshot!(".txt", b"abcd".to_vec());

// named:
insta::assert_binary_snapshot!("my_snapshot.bin", [0, 1, 2, 3].to_vec());
}
```

## Debug expressions

Snapshots optionally accept a debug expression, which can be helpful for adding
Expand Down