assert-or-bless

Crates.ioassert-or-bless
lib.rsassert-or-bless
version0.1.2
created_at2025-08-05 18:50:21.16448+00
updated_at2025-08-05 19:13:38.572355+00
descriptionAssert that a multi-line string equals the contents of a blessable snapshot file. Print a nice colored diff if not.
homepagehttps://github.com/Enselic/assert-or-bless
repositoryhttps://github.com/Enselic/assert-or-bless
max_upload_size
id1782515
size10,558
Martin Nordholts (Enselic)

documentation

https://docs.rs/assert-or-bless

README

Audit the code

This crate is ~30 lines of code. Audit with the following one-liner, but make sure you follow to the crates.io Data Access Policy:

curl -H "User-Agent: $USER at $HOST" \
     -L https://crates.io/api/v1/crates/assert-or-bless/0.1.2/download |
         tar --extract --gzip --to-stdout | less

Usage

Write a test:

#[test]
fn check_snapshot() {
    let actual == "...";
    assert_or_bless::assert_eq_or_bless(actual, "snapshot.txt");
}

Bless current output (write the snapshot file):

ASSERT_OR_BLESS=bless cargo test

Assert current output (compare with existing snapshot file):

cargo test
Commit count: 0

cargo fmt