summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDan Davison <dandavison7@gmail.com>2022-03-07 08:20:48 -0500
committerDan Davison <dandavison7@gmail.com>2022-03-07 12:58:28 -0500
commitc0bb90c86e90fcafbb6aacab996960ec55a0f5cd (patch)
tree30086b621d22376e7a16c0a6d7e158552c5d99ff
parentfd3770875be43b28aed72adc7b3fec44d5a7a80d (diff)
Add failing test for #1002
-rw-r--r--src/tests/test_example_diffs.rs30
1 files changed, 30 insertions, 0 deletions
diff --git a/src/tests/test_example_diffs.rs b/src/tests/test_example_diffs.rs
index 0db30977..2eca792f 100644
--- a/src/tests/test_example_diffs.rs
+++ b/src/tests/test_example_diffs.rs
@@ -136,6 +136,15 @@ mod tests {
}
#[test]
+ fn test_diff_unified_concatenated() {
+ // See #1002. Line buffers were not being flushed correctly, leading to material from first
+ // file last hunk appearing at beginning of second file first hunk.
+ DeltaTest::with_args(&[])
+ .with_input(DIFF_UNIFIED_CONCATENATED)
+ .expect_contains("\nLINES.\n\n1/y 2022-03-06");
+ }
+
+ #[test]
#[ignore] // Ideally, delta would make this test pass. See #121.
fn test_delta_ignores_non_diff_input() {
let config = integration_test_utils::make_config_from_args(&[]);
@@ -1875,6 +1884,27 @@ Only in b/: just_b
+This is different from a
";
+ const DIFF_UNIFIED_CONCATENATED: &str = "\
+--- 1/x 2022-03-06 11:16:06.313403500 -0800
++++ 2/x 2022-03-06 11:18:14.083403500 -0800
+@@ -1,5 +1,5 @@
+ This
+-is
++IS
+ a
+ few
+-lines.
++LINES.
+--- 1/y 2022-03-06 11:16:44.483403500 -0800
++++ 2/y 2022-03-06 11:16:55.213403500 -0800
+@@ -1,4 +1,4 @@
+ This
+ is
+-another
++ANOTHER
+ test.
+";
+
const NOT_A_DIFF_OUTPUT: &str = "\
Hello world
This is a regular file that contains: