From b12c0f0be4ecb9c02492ff8197c04ff74b62ec62 Mon Sep 17 00:00:00 2001 From: Fred Gobry Date: Sun, 7 Jun 2026 15:12:25 -0400 Subject: [PATCH] radicle-cli: fix tests for git ddiff on Windows. I took the easy way of changing the tests to compare the lines independently, as I suspect diffs should remain platform-specific. --- crates/radicle-cli/src/git/ddiff.rs | 9 ++++++--- crates/radicle-cli/src/git/unified_diff.rs | 18 ++++++++++++------ 2 files changed, 18 insertions(+), 9 deletions(-) diff --git a/crates/radicle-cli/src/git/ddiff.rs b/crates/radicle-cli/src/git/ddiff.rs index 0938adb3..fd61134b 100644 --- a/crates/radicle-cli/src/git/ddiff.rs +++ b/crates/radicle-cli/src/git/ddiff.rs @@ -410,12 +410,15 @@ mod tests { "/tests/data/ddiff_hunk.diff" ))) .unwrap(); - assert_eq!( + // Lines are expected to match but line ending might differ depending + // on the platform. + assert!( include_str!(concat!( env!("CARGO_MANIFEST_DIR"), "/tests/data/ddiff_hunk.diff" - )), - ddiff.to_unified_string().unwrap() + )) + .lines() + .eq(ddiff.to_unified_string().unwrap().lines()) ); } } diff --git a/crates/radicle-cli/src/git/unified_diff.rs b/crates/radicle-cli/src/git/unified_diff.rs index c8b91af2..3b4fc8f7 100644 --- a/crates/radicle-cli/src/git/unified_diff.rs +++ b/crates/radicle-cli/src/git/unified_diff.rs @@ -626,9 +626,12 @@ mod test { "/tests/data/diff.diff" ))) .unwrap(); - assert_eq!( - include_str!(concat!(env!("CARGO_MANIFEST_DIR"), "/tests/data/diff.diff")), - diff_a.to_unified_string().unwrap() + // Lines are expected to match but line ending might differ depending + // on the platform. + assert!( + include_str!(concat!(env!("CARGO_MANIFEST_DIR"), "/tests/data/diff.diff")) + .lines() + .eq(diff_a.to_unified_string().unwrap().lines()) ); } @@ -639,12 +642,15 @@ mod test { "/tests/data/diff_body.diff" ))) .unwrap(); - assert_eq!( + // Lines are expected to match but line ending might differ depending + // on the platform. + assert!( include_str!(concat!( env!("CARGO_MANIFEST_DIR"), "/tests/data/diff_body.diff" - )), - diff_content.to_unified_string().unwrap() + )) + .lines() + .eq(diff_content.to_unified_string().unwrap().lines()) ); }