From f3529789036cfebd8eff2c85f7e7a5721c20c085 Mon Sep 17 00:00:00 2001 From: Li Junchen Date: Wed, 28 Aug 2024 15:27:01 +0800 Subject: [PATCH] ignore differences between LF and CRLF (#227) --- crates/moonbuild/src/expect.rs | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/crates/moonbuild/src/expect.rs b/crates/moonbuild/src/expect.rs index 9b196082..19e268f5 100644 --- a/crates/moonbuild/src/expect.rs +++ b/crates/moonbuild/src/expect.rs @@ -686,7 +686,10 @@ pub fn snapshot_eq(msg: &str) -> anyhow::Result { } else { "".to_string() }; - let eq = actual == expect; + fn normalize_string(s: &str) -> String { + s.replace("\r\n", "\n").replace('\r', "") + } + let eq = normalize_string(&actual) == normalize_string(&expect); Ok(eq) }