diff options
| author | norisio <norisio@users.noreply.github.com> | 2021-07-23 06:34:35 +0900 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2021-07-22 22:34:35 +0100 |
| commit | 63fdebbf68878fa52fe178f0e5d2a89478345878 (patch) | |
| tree | b771847c690142ca8fe7c5152b29fad039e78c1a /src/tests/test_example_diffs.rs | |
| parent | e5664693a955a81143a00c686e7c374f62692bc5 (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.rs | 24 |
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)][m "; + const GIT_DIFF_SINGLE_HUNK_WITH_SEQUENCE_OF_CR_ESCAPE_SEQUENCES_LF: &str = "\ +[1mdiff --git a/src/main.rs b/src/main.rs[m +[1mindex f346a8c..e443b63 100644[m +[1m--- a/src/main.rs[m +[1m+++ b/src/main.rs[m +[36m@@ -1,5 +1,4 @@[m +[31m-deleted line[m\r +[31m-[m\r + fn main() {[m\r + println!(\"existing line\");[m\r +[32m+[m[32m println!(\"added line\");[m[41m\r[m + }[m\r +"; + const DIFF_IN_DIFF: &str = "\ diff --git a/0001-Init.patch b/0001-Init.patch deleted file mode 100644 |
