Skip to content

Commit

Permalink
Add test_orphan_carriage_return_is_stripped
Browse files Browse the repository at this point in the history
  • Loading branch information
norisio committed Jul 22, 2021
1 parent 3c1fd02 commit 230d529
Showing 1 changed file with 24 additions and 0 deletions.
24 changes: 24 additions & 0 deletions src/tests/test_example_diffs.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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(&[
Expand Down Expand Up @@ -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
Expand Down

0 comments on commit 230d529

Please sign in to comment.