[][src]Crate egress

A super simple, extremely bare-bones regression test library.

This is very minimal and currently doesn't support all that much in the way of API, but if all you want is some super basic regression testing, here it is.

Example

let mut egress = egress!();
let artifact = egress.artifact("basic_arithmetic");

let super_complex_test_output_that_could_change_at_any_time = 1 + 1;

// using `serde::Serialize`:
artifact.insert_serialize("1 + 1 (serde)", &super_complex_test_output_that_could_change_at_any_time);

// or using `fmt::Debug`:
artifact.insert_debug("1 + 1 (fmt::Debug)", &super_complex_test_output_that_could_change_at_any_time);

// or using `fmt::Display`:
artifact.insert_display("1 + 1 (fmt::Display)", &super_complex_test_output_that_could_change_at_any_time);

// More options available; please check the docs.

egress.close().unwrap().assert_unregressed();

To see the artifacts produced by this example, check egress/artifacts/rust_out/basic_arithmetic.json.

Macros

egress

Shorthand macro for opening an Egress context, keyed by the module_path!() of the file it's called in.

Structs

Artifact

An Artifact is the main object that Egress uses to handle and compare data produced from your tests. It's basically just a map from string keys to Entrys.

Egress

A testing context. You can open as many as you want, but make sure their artifact_subdirs don't collide.

Report

Comparison report for newly generated artifacts versus the artifacts stored in artifacts_subdir.

Enums

Entry

Artifacts are maps from string keys to Entry objects. Entries in an artifact can be strings, JSON values, byte buffers, or - because artifacts are tree structured - another Artifact.

ErrorKind

Possible failure modes for creating and closing Egress contexts.