pub fn create_patch<'a>(original: &'a str, modified: &'a str) -> Patch<'a, str>
Expand description

Create a patch between two texts.

let original = "\
I am afraid, however, that all I have known - that my story - will be forgotten.
I am afraid for the world that is to come.
Afraid that my plans will fail.
Afraid of a doom worse than the Deepness.
";

let modified = "\
I am afraid, however, that all I have known - that my story - will be forgotten.
I am afraid for the world that is to come.
Afraid that Alendi will fail.
Afraid of a doom brought by the Deepness.
";

let expected = "\
--- original
+++ modified
@@ -1,4 +1,4 @@
 I am afraid, however, that all I have known - that my story - will be forgotten.
 I am afraid for the world that is to come.
-Afraid that my plans will fail.
-Afraid of a doom worse than the Deepness.
+Afraid that Alendi will fail.
+Afraid of a doom brought by the Deepness.
";

let patch = create_patch(original, modified);
assert_eq!(patch.to_string(), expected);