Registry / testing / expectorate

expectorate

JSON →
library1.2.0rscratesunverified

Library for comparing output to file contents with simple updating, useful for snapshot testing.

# Cargo.toml [dependencies] expectorate = "1.2.0"
INSTALL
IMPORT
SIG · EXPECTORATE
E
expectorate
testingrustv1.2.0
harness data pending
Install & Compatibility
Where this runs

No compatibility data collected yet for this library.

Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

expect_file
use expectorate::expect_file;

Compares a string to the contents of a file, updating the file if needed.

use expectorate::expect_file; fn main() { let output = "expected content"; expect_file!("tests/fixtures/output.txt").to_eq(output); }
Debug
Known issues
gotchaFile updates happen automatically when the test is run with UPDATE_EXPECT=1, which may overwrite expected outputs unintentionally.
fix
Set the environment variable UPDATE_EXPECT=1 only when you intend to update snapshots.
affects: >=0.0.0
Upgrade
Version history
1.2.0latest on crates.io
Audit
Dependencies

No dependency data recorded yet.

Agent activity
6 hits · last 30 days
node
4
Resources
expectorate — cargo add expectorate · libregistry