summaryrefslogtreecommitdiff
path: root/src/tests/test_example_diffs.rs
diff options
context:
space:
mode:
authornorisio <norisio@users.noreply.github.com>2021-07-23 06:34:35 +0900
committerGitHub <noreply@github.com>2021-07-22 22:34:35 +0100
commit63fdebbf68878fa52fe178f0e5d2a89478345878 (patch)
treeb771847c690142ca8fe7c5152b29fad039e78c1a /src/tests/test_example_diffs.rs
parente5664693a955a81143a00c686e7c374f62692bc5 (diff)
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
Diffstat (limited to 'src/tests/test_example_diffs.rs')
-rw-r--r--src/tests/test_example_diffs.rs24
1 files changed, 24 insertions, 0 deletions
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
@@ -297,6 +297,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(&[
"--commit-style",
@@ -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