This crate seems to fail if either the patch text or the text being patched contain Windows line endings. For example, the following test cases:
let text_lf = "Allomancy\nFeruchemy\n";
let text_crlf = "Allomancy\r\nFeruchemy\r\n";
let patch_lf =
"\
--- original\n\
+++ modified\n\
@@ -1,2 +1,3 @@\n Allomancy\n Feruchemy\n+Hemalurgy\n";
let patch_crlf =
"\
--- original\r\n\
+++ modified\r\n\
@@ -1,2 +1,3 @@\r\n Allomancy\r\n Feruchemy\r\n+Hemalurgy\r\n";
let p_lf = Patch::from_str(&patch_lf).unwrap();
let p_crlf = Patch::from_str(&patch_crlf);
assert!(diffy::apply(text_lf, &p_lf).is_ok()); // OK
assert!(p_crlf.is_ok()); // ParsePatchError("invalid char in unquoted filename")
assert!(diffy::apply(text_crlf, &p_lf).is_ok()); // ApplyError(1)
The latter two asserts fail. Would you be open to supporting Windows line endings in this crate? I'd be happy to PR if one is welcome.
This crate seems to fail if either the patch text or the text being patched contain Windows line endings. For example, the following test cases:
The latter two asserts fail. Would you be open to supporting Windows line endings in this crate? I'd be happy to PR if one is welcome.