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
assert_snap!: Asserts any types implementingDisplay.assert_debug_snap!: Asserts any types implementingDebug.
§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.