diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-06-19 09:25:56 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-06-19 09:25:56 +0000 |
commit | 018c4950b9406055dec02ef0fb52f132e2bb1e2c (patch) | |
tree | a835ebdf2088ef88fa681f8fad45f09922c1ae9a /src/tools/cargo/crates/mdman | |
parent | Adding debian version 1.75.0+dfsg1-5. (diff) | |
download | rustc-018c4950b9406055dec02ef0fb52f132e2bb1e2c.tar.xz rustc-018c4950b9406055dec02ef0fb52f132e2bb1e2c.zip |
Merging upstream version 1.76.0+dfsg1.
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'src/tools/cargo/crates/mdman')
-rw-r--r-- | src/tools/cargo/crates/mdman/Cargo.toml | 5 | ||||
-rw-r--r-- | src/tools/cargo/crates/mdman/src/main.rs | 2 | ||||
-rw-r--r-- | src/tools/cargo/crates/mdman/tests/compare.rs | 16 | ||||
-rw-r--r-- | src/tools/cargo/crates/mdman/tests/invalid.rs | 6 |
4 files changed, 12 insertions, 17 deletions
diff --git a/src/tools/cargo/crates/mdman/Cargo.toml b/src/tools/cargo/crates/mdman/Cargo.toml index fd33da3c2..4e86b8e1a 100644 --- a/src/tools/cargo/crates/mdman/Cargo.toml +++ b/src/tools/cargo/crates/mdman/Cargo.toml @@ -16,4 +16,7 @@ serde_json.workspace = true url.workspace = true [dev-dependencies] -pretty_assertions.workspace = true +snapbox.workspace = true + +[lints] +workspace = true diff --git a/src/tools/cargo/crates/mdman/src/main.rs b/src/tools/cargo/crates/mdman/src/main.rs index facaa5120..3c09bc4dd 100644 --- a/src/tools/cargo/crates/mdman/src/main.rs +++ b/src/tools/cargo/crates/mdman/src/main.rs @@ -1,3 +1,5 @@ +#![allow(clippy::print_stderr)] + use anyhow::{bail, format_err, Context, Error}; use mdman::{Format, ManMap}; use std::collections::HashMap; diff --git a/src/tools/cargo/crates/mdman/tests/compare.rs b/src/tools/cargo/crates/mdman/tests/compare.rs index 3e679d127..fde2c235d 100644 --- a/src/tools/cargo/crates/mdman/tests/compare.rs +++ b/src/tools/cargo/crates/mdman/tests/compare.rs @@ -1,11 +1,8 @@ //! Compares input to expected output. -//! -//! Use the MDMAN_BLESS environment variable to automatically update the -//! expected output. -use mdman::{Format, ManMap}; -use pretty_assertions::assert_eq; use std::path::PathBuf; + +use mdman::{Format, ManMap}; use url::Url; fn run(name: &str) { @@ -25,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/src/tools/cargo/crates/mdman/tests/invalid.rs b/src/tools/cargo/crates/mdman/tests/invalid.rs index cc81d06c4..b8be1ed24 100644 --- a/src/tools/cargo/crates/mdman/tests/invalid.rs +++ b/src/tools/cargo/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()); } } } |