Skip to main content

assert_snap

Function assert_snap 

Source
pub fn assert_snap(
    actual: &str,
    expected: &str,
    redaction_rules: &[RedactionRule<'_>],
)
Expand description

Asserts that an actual value matches an expected snapshot value after applying redaction rules.

This function compares actual against expected after applying the provided redaction_rules to the actual value. If they don’t match, it prints diagnostic information and panics.

§Arguments

  • actual - The actual value produced by the code under test.
  • expected - The expected snapshot value to compare against.
  • redaction_rules - A slice of redaction rules to apply to actual before comparison. These are typically used to mask dynamic content like timestamps, IDs, or memory addresses.

§Panics

Panics if the redacted actual does not equal expected. When the diff feature is enabled, a unified diff is printed showing the differences.