Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 7 additions & 1 deletion crates/snapbox/src/harness.rs
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
//! name,
//! fixture: input_path,
//! expected,
//! format: None,
//! }
//! }
//!
Expand Down Expand Up @@ -125,7 +126,10 @@ where
Trial::test(case.name.clone(), move || {
let actual = (test)(&case.fixture)?;
let actual = actual.to_string();
let actual = crate::Data::text(actual).normalize(NormalizeNewlines);
let mut actual = crate::Data::text(actual).normalize(NormalizeNewlines);
if let Some(format) = case.format {
actual = actual.coerce_to(format);
}
#[allow(deprecated)]
let verify = Verifier::new()
.palette(crate::report::Palette::auto())
Expand Down Expand Up @@ -229,4 +233,6 @@ pub struct Case {
pub fixture: std::path::PathBuf,
/// What the actual output should be compared against or updated
pub expected: std::path::PathBuf,
/// Explicitly specify what format `expected` is stored in
pub format: Option<DataFormat>,
}
1 change: 1 addition & 0 deletions crates/snapbox/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,7 @@
//! name,
//! fixture: input_path,
//! expected,
//! format: None,
//! }
//! }
//!
Expand Down