mirror of
https://github.com/rust-lang/cargo
synced 2024-10-13 11:12:25 +00:00
Auto merge of #13098 - epage:snap, r=weihanglo
test(mdman): Switch to snapbox Working with #13090 is the motivation Benefits - We use it elsewhere - We don't have to bake in our own snapshotting solution - It is more obvious how to update the snapshots
This commit is contained in:
commit
f023d057e1
24
Cargo.lock
generated
24
Cargo.lock
generated
|
@ -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"
|
||||
|
@ -2191,10 +2185,10 @@ version = "0.0.0"
|
|||
dependencies = [
|
||||
"anyhow",
|
||||
"handlebars",
|
||||
"pretty_assertions",
|
||||
"pulldown-cmark",
|
||||
"same-file",
|
||||
"serde_json",
|
||||
"snapbox",
|
||||
"url",
|
||||
]
|
||||
|
||||
|
@ -2621,16 +2615,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"
|
||||
|
@ -3960,12 +3944,6 @@ dependencies = [
|
|||
"toml_edit",
|
||||
]
|
||||
|
||||
[[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"
|
||||
|
|
|
@ -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.4.0"
|
||||
pulldown-cmark = { version = "0.9.3", default-features = false }
|
||||
rand = "0.8.5"
|
||||
|
|
|
@ -16,7 +16,7 @@ serde_json.workspace = true
|
|||
url.workspace = true
|
||||
|
||||
[dev-dependencies]
|
||||
pretty_assertions.workspace = true
|
||||
snapbox.workspace = true
|
||||
|
||||
[lints]
|
||||
workspace = true
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -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());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue