macro_rules! assert_compact_json_snapshot {
    ($value:expr, @$snapshot:literal) => { ... };
    ($value:expr, {$($k:expr => $v:expr),*$(,)?}, @$snapshot:literal) => { ... };
    ($value:expr, {$($k:expr => $v:expr),*$(,)?}) => { ... };
    ($name:expr, $value:expr) => { ... };
    ($name:expr, $value:expr, {$($k:expr => $v:expr),*$(,)?}) => { ... };
    ($value:expr) => { ... };
}
Available on crate feature json only.
Expand description

Asserts a Serialize snapshot in compact JSON format.

Feature: json

This works exactly like assert_json_snapshot! but serializes into a single line for as long as the output is less than 120 characters. This can be useful in cases where you are working with small result outputs but comes at the cost of slightly worse diffing behavior.

Example:

assert_compact_json_snapshot!(vec![1, 2, 3]);

The third argument to the macro can be an object expression for redaction. It’s in the form { selector => replacement }. For more information about redactions refer to the redactions feature in the guide.

The snapshot name is optional but can be provided as first argument.