From 63fdebbf68878fa52fe178f0e5d2a89478345878 Mon Sep 17 00:00:00 2001 From: norisio Date: Fri, 23 Jul 2021 06:34:35 +0900 Subject: Fix the empty result issue in add -p (#664) * Strip a neglected CR character in ingest_line * Add test_orphan_carriage_return_is_stripped * Eliminate redundant assignment in if-let-Some --- src/tests/test_example_diffs.rs | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) (limited to 'src/tests/test_example_diffs.rs') diff --git a/src/tests/test_example_diffs.rs b/src/tests/test_example_diffs.rs index 1a1d999..c605715 100644 --- a/src/tests/test_example_diffs.rs +++ b/src/tests/test_example_diffs.rs @@ -296,6 +296,16 @@ commit 94907c0f136f46dc46ffae2dc92dca9af7eb7c2e ); } + #[test] + fn test_orphan_carriage_return_is_stripped() { + let config = integration_test_utils::make_config_from_args(&[]); + let output = integration_test_utils::run_delta( + GIT_DIFF_SINGLE_HUNK_WITH_SEQUENCE_OF_CR_ESCAPE_SEQUENCES_LF, + &config, + ); + assert!(output.bytes().all(|b: u8| b != b'\r')); + } + #[test] fn test_commit_decoration_style_omit() { _do_test_commit_style_no_decoration(&[ @@ -1708,6 +1718,20 @@ Date: Thu May 14 11:13:17 2020 -0400 #[allow(dead_code)] "; + const GIT_DIFF_SINGLE_HUNK_WITH_SEQUENCE_OF_CR_ESCAPE_SEQUENCES_LF: &str = "\ +diff --git a/src/main.rs b/src/main.rs +index f346a8c..e443b63 100644 +--- a/src/main.rs ++++ b/src/main.rs +@@ -1,5 +1,4 @@ +-deleted line\r +-\r + fn main() {\r + println!(\"existing line\");\r ++ println!(\"added line\");\r + }\r +"; + const DIFF_IN_DIFF: &str = "\ diff --git a/0001-Init.patch b/0001-Init.patch deleted file mode 100644 -- cgit v1.2.3