Skip to content

Commit e165a3d

Browse files
test: use pretty_assertions (#260)
* test: use assert_matches in pretty_assertions * style: apply automated fixes --------- Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>
1 parent ca16e0b commit e165a3d

10 files changed

Lines changed: 12 additions & 13 deletions

File tree

Cargo.lock

Lines changed: 0 additions & 7 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,11 +36,10 @@ tracing-subscriber = "0.3.22"
3636
usage-lib = { version = "2.18.2", features = ["clap", "docs"] }
3737

3838
[dev-dependencies]
39-
assert_matches = "1.5.0"
4039
ctor = "0.2.8"
4140
duct = "1.1.1"
4241
insta = { version = "1.46.3", features = ["json"] }
43-
pretty_assertions = "1.4.1"
42+
pretty_assertions = { version = "1.4.1", features = ["unstable"] }
4443
rstest = "0.26.1"
4544
serial_test = "3.4.0"
4645
tempfile = "3.26.0"

clippy.toml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
disallowed-macros = [
2+
{ path = "std::assert_eq", reason = "Please use pretty_assertions::assert_eq! for better diff output in tests." },
3+
{ path = "std::assert_ne", reason = "Please use pretty_assertions::assert_ne! for better diff output in tests." },
4+
]
15
disallowed-types = [
26
{ path = "eyre::Result", reason = "Please use `crate::Result` instead to ensure consistent error handling across the crate." },
37
{ path = "color_eyre::Result", reason = "Please use `crate::Result` instead to ensure consistent error handling across the crate." },

src/cli/init.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -128,6 +128,7 @@ fn quote_keys_for_jsonc(body: &str) -> String {
128128
mod tests {
129129
use super::*;
130130
use insta::assert_snapshot;
131+
use pretty_assertions::assert_eq;
131132
use rstest::rstest;
132133

133134
#[rstest]

src/cli/mod.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -121,6 +121,7 @@ pub async fn run() -> Result<()> {
121121
#[cfg(test)]
122122
mod tests {
123123
use super::*;
124+
use pretty_assertions::assert_eq;
124125

125126
#[test]
126127
fn cli_run_subcommand() {

src/cli/run.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,8 +26,8 @@ impl Run {
2626
#[cfg(test)]
2727
mod tests {
2828
use crate::cli::{Cli, Commands};
29-
use assert_matches::assert_matches;
3029
use clap::Parser as _;
30+
use pretty_assertions::{assert_eq, assert_matches};
3131

3232
#[test]
3333
fn run_command() {

src/config/format.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,7 @@ impl ConfigFormat {
4141
#[cfg(test)]
4242
mod tests {
4343
use super::*;
44+
use pretty_assertions::assert_eq;
4445

4546
#[test]
4647
fn all_formats() {

src/config/load.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -201,8 +201,7 @@ fn find_single_config(base_paths_no_ext: &[PathBuf]) -> Result<Option<(PathBuf,
201201
mod tests {
202202
use super::*;
203203
use crate::testing::EnvCleanup;
204-
use assert_matches::assert_matches;
205-
use pretty_assertions::assert_eq;
204+
use pretty_assertions::{assert_eq, assert_matches, assert_ne};
206205
use rstest::rstest;
207206
use serial_test::serial;
208207
use std::fs;

src/ssh/auth.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -126,7 +126,7 @@ fn resolve_default_key_path() -> Option<PathBuf> {
126126
#[cfg(test)]
127127
mod tests {
128128
use super::*;
129-
use assert_matches::assert_matches;
129+
use pretty_assertions::assert_matches;
130130
use serial_test::serial;
131131
use std::fs;
132132

src/ssh/exec.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -162,6 +162,7 @@ pub async fn execute_command(
162162
#[cfg(test)]
163163
mod tests {
164164
use super::*;
165+
use pretty_assertions::assert_eq;
165166

166167
#[test]
167168
fn build_command_no_args() {

0 commit comments

Comments
 (0)