pub fn normalize_inline_literal(raw: &str) -> StringExpand description
Normalizes an inline-snapshot literal to the text it actually stands for.
Test source indents the literal for readability, so the raw token is not
the snapshot. Normalization undoes exactly the cosmetic part: it drops a
single leading newline (the r#"-then-newline idiom), removes the common
leading indentation shared by every non-blank line, and trims trailing
whitespace. A single-line literal with no leading newline is returned
trimmed of trailing whitespace and otherwise untouched.
use test_better_core::TestResult;
use test_better_matchers::{eq, check};
use test_better_snapshot::normalize_inline_literal;
let raw = "\n User { name: \"alice\" }\n";
check!(normalize_inline_literal(raw)).satisfies(eq("User { name: \"alice\" }".to_string()))?;