Skip to main content

Crate assert_snap

Crate assert_snap 

Source
Expand description

§assert-snap

A snapshot testing and assertion library for Rust that supports flexible, regex-based dynamic data redactions and detailed unified diff output.

§Main Macros

§Quick Example

use assert_snap::{assert_snap, assert_debug_snap};

// Simple string assertion with regex redaction
assert_snap!(
    "User id: 12345, status: active",
    "User id: [ID], status: active",
    r"\d+" => "[ID]"
);

// Debug format assertion
assert_debug_snap!(Some("secret"), Some("secret"));

Modules§

assert_impl
Implementation module containing core assertion comparison and unified diff display logic.
redaction
Redaction module for masking dynamic or sensitive text using regular expressions.

Macros§

assert_debug_snap
Asserts any types implementing Debug.
assert_snap
Asserts any types implementing Display.