From 5c8b350b3531102359b89e9f0a3367e6de4a43f4 Mon Sep 17 00:00:00 2001 From: Jack O'Connor Date: Tue, 26 Nov 2024 18:38:04 -0800 Subject: [PATCH] another Windows-style newlines test --- b3sum/tests/cli_tests.rs | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/b3sum/tests/cli_tests.rs b/b3sum/tests/cli_tests.rs index f501ca6f..cd48ac73 100644 --- a/b3sum/tests/cli_tests.rs +++ b/b3sum/tests/cli_tests.rs @@ -419,6 +419,24 @@ fn test_check() { assert_eq!(expected_check_output, stdout); assert_eq!("", stderr); + // Check the same file, but with Windows-style newlines. + let windows_style = expected_checkfile.replace("\n", "\r\n"); + let output = cmd!(b3sum_exe(), "--check") + .stdin_bytes(windows_style.as_bytes()) + .dir(dir.path()) + .stdout_capture() + .stderr_capture() + .run() + .unwrap(); + let stdout = std::str::from_utf8(&output.stdout).unwrap(); + let stderr = std::str::from_utf8(&output.stderr).unwrap(); + let expected_check_output = "\ + a: OK\n\ + b: OK\n\ + c/d: OK\n"; + assert_eq!(expected_check_output, stdout); + assert_eq!("", stderr); + // Now pass the same checkfile twice on the command line just for fun. let checkfile_path = dir.path().join("checkfile"); fs::write(&checkfile_path, &expected_checkfile).unwrap();