diff --git a/Cargo.lock b/Cargo.lock index aff404981366..c5c79392d1b0 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -777,12 +777,6 @@ dependencies = [ "serde", ] -[[package]] -name = "diff" -version = "0.1.13" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "56254986775e3233ffa9c4d7d3faaf6d36a2c09d30b20687e9f88bc8bafc16c8" - [[package]] name = "digest" version = "0.10.7" @@ -2192,10 +2186,10 @@ version = "0.0.0" dependencies = [ "anyhow", "handlebars", - "pretty_assertions", "pulldown-cmark", "same-file", "serde_json", + "snapbox", "url", ] @@ -2622,16 +2616,6 @@ version = "0.2.17" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "5b40af805b3121feab8a3c29f04d8ad262fa8e0561883e7653e024ae4479e6de" -[[package]] -name = "pretty_assertions" -version = "1.4.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "af7cee1a6c8a5b9208b3cb1061f10c0cb689087b3d8ce85fb9d2dd7a29b6ba66" -dependencies = [ - "diff", - "yansi", -] - [[package]] name = "primeorder" version = "0.13.2" @@ -3902,12 +3886,6 @@ dependencies = [ "toml_edit 0.21.0", ] -[[package]] -name = "yansi" -version = "0.5.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "09041cd90cf85f7f8b2df60c646f853b7f535ce68f85244eb6731cf89fa498ec" - [[package]] name = "zeroize" version = "1.6.0" diff --git a/Cargo.toml b/Cargo.toml index f1f0b042a289..22a18fb6e6f4 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -69,7 +69,6 @@ pasetors = { version = "0.6.7", features = ["v3", "paserk", "std", "serde"] } pathdiff = "0.2" percent-encoding = "2.3" pkg-config = "0.3.27" -pretty_assertions = "1.4.0" proptest = "1.3.1" pulldown-cmark = { version = "0.9.3", default-features = false } rand = "0.8.5" diff --git a/crates/mdman/Cargo.toml b/crates/mdman/Cargo.toml index 95adc0cb158c..4e86b8e1a683 100644 --- a/crates/mdman/Cargo.toml +++ b/crates/mdman/Cargo.toml @@ -16,7 +16,7 @@ serde_json.workspace = true url.workspace = true [dev-dependencies] -pretty_assertions.workspace = true +snapbox.workspace = true [lints] workspace = true diff --git a/crates/mdman/tests/compare.rs b/crates/mdman/tests/compare.rs index 8af53ed6bd7b..fde2c235d36c 100644 --- a/crates/mdman/tests/compare.rs +++ b/crates/mdman/tests/compare.rs @@ -1,13 +1,8 @@ //! Compares input to expected output. -//! -//! Use the MDMAN_BLESS environment variable to automatically update the -//! expected output. -#![allow(clippy::disallowed_methods)] +use std::path::PathBuf; use mdman::{Format, ManMap}; -use pretty_assertions::assert_eq; -use std::path::PathBuf; use url::Url; fn run(name: &str) { @@ -27,14 +22,7 @@ fn run(name: &str) { name, format.extension(section) ); - if std::env::var("MDMAN_BLESS").is_ok() { - std::fs::write(&expected_path, result).unwrap(); - } else { - let expected = std::fs::read_to_string(&expected_path).unwrap(); - // Fix if Windows checked out with autocrlf. - let expected = expected.replace("\r\n", "\n"); - assert_eq!(expected, result); - } + snapbox::assert_eq_path(expected_path, result); } } diff --git a/crates/mdman/tests/invalid.rs b/crates/mdman/tests/invalid.rs index cc81d06c4271..b8be1ed24c39 100644 --- a/crates/mdman/tests/invalid.rs +++ b/crates/mdman/tests/invalid.rs @@ -1,9 +1,9 @@ //! Tests for errors and invalid input. -use mdman::{Format, ManMap}; -use pretty_assertions::assert_eq; use std::path::PathBuf; +use mdman::{Format, ManMap}; + fn run(name: &str, expected_error: &str) { let input = PathBuf::from(format!("tests/invalid/{}", name)); match mdman::convert(&input, Format::Man, None, ManMap::new()) { @@ -11,7 +11,7 @@ fn run(name: &str, expected_error: &str) { panic!("expected {} to fail", name); } Err(e) => { - assert_eq!(expected_error, e.to_string()); + snapbox::assert_eq(expected_error, e.to_string()); } } }