about summary refs log tree commit diff
path: root/src/rustfmt_diff.rs
diff options
context:
space:
mode:
authorChris Emerson <github@mail.nosreme.org>2017-10-19 23:03:27 +0100
committerChris Emerson <github@mail.nosreme.org>2017-10-19 23:03:27 +0100
commit6c1c81bbced8c6d98701ea70845f1626ac703c31 (patch)
treeec2beb937a467b7efbf9ce79eb2524f293861bf7 /src/rustfmt_diff.rs
parent6282c970cf3dcd0e30c3e1751768cc2d18c7295d (diff)
Add a test for two nearby chunks (with context).
Diffstat (limited to 'src/rustfmt_diff.rs')
-rw-r--r--src/rustfmt_diff.rs20
1 files changed, 20 insertions, 0 deletions
diff --git a/src/rustfmt_diff.rs b/src/rustfmt_diff.rs
index 644ad7ceeac..fa3c6305ed8 100644
--- a/src/rustfmt_diff.rs
+++ b/src/rustfmt_diff.rs
@@ -183,6 +183,26 @@ mod test {
     }
 
     #[test]
+    fn diff_simple2() {
+        let src = "one\ntwo\nthree\nfour\nfive\nsix\nseven\n";
+        let dest= "one\ntwo\ntrois\nfour\ncinq\nsix\nseven\n";
+        let diff = make_diff(src, dest, 1);
+        assert_eq!(diff, vec![Mismatch { line_number: 2,
+                                         lines: vec![
+                                             Context("two".into()),
+                                             Resulting("three".into()),
+                                             Expected("trois".into()),
+                                             Context("four".into()),
+                                         ] },
+                              Mismatch { line_number: 5,
+                                         lines: vec![
+                                             Resulting("five".into()),
+                                             Expected("cinq".into()),
+                                             Context("six".into()),
+                                         ] }]);
+    }
+
+    #[test]
     fn diff_zerocontext() {
         let src = "one\ntwo\nthree\nfour\nfive\n";
         let dest= "one\ntwo\ntrois\nfour\nfive\n";