Add a simple passing test for diffs.
@@ -162,3 +162,23 @@ where
}
}
}
+
+#[cfg(test)]
+mod test {
+ use super::{make_diff,Mismatch};
+ use super::DiffLine::*;
+
+ #[test]
+ fn simple_diff() {
+ let src = "one\ntwo\nthree\nfour\nfive\n";
+ let dest= "one\ntwo\ntrois\nfour\nfive\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()),
+ ] }]);
+ }
+}
\ No newline at end of file
