my fork of dmp
| -rw-r--r-- | CHANGELOG.md | 5 | ||||
| -rw-r--r-- | Cargo.toml | 2 | ||||
| -rw-r--r-- | README.md | 2 | ||||
| -rw-r--r-- | src/dmp.rs | 5 | ||||
| -rw-r--r-- | tests/test.rs | 16 |
5 files changed, 17 insertions, 13 deletions
diff --git a/CHANGELOG.md b/CHANGELOG.md index 23d0fa0..8df6577 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,10 @@ # CHANGELOG.md +## 0.5.1 +Fix: + + - Fix full overlap elimination for inserts with trailing deletes by @aschamp-figma + ## 0.5.0 Features: @@ -1,6 +1,6 @@ [package] name = "diff-match-patch-rs" -version = "0.5.0" +version = "0.5.1" edition = "2021" authors = ["Anubhab Bandyopadhyay"] homepage = "https://docs.rs/diff-match-patch-rs" @@ -39,7 +39,7 @@ Benchmarks are maintained [diff-match-patch-bench repository](https://github.com ```toml [dependencies] -diff-match-patch-rs = "0.5.0" +diff-match-patch-rs = "0.5.1" ``` ### `Effitient` mode @@ -4494,17 +4494,16 @@ mod tests { let mut diffs = vec![ Diff::delete(&"abcd1212".chars().collect::<Vec<_>>()[..]), Diff::insert(&"1212".chars().collect::<Vec<_>>()[..]), - Diff::equal(&"wxyz".chars().collect::<Vec<_>>()[..]), + Diff::equal(&"wxyz".chars().collect::<Vec<_>>()[..]), ]; let test = vec![ Diff::delete(&"abcd".chars().collect::<Vec<_>>()[..]), Diff::equal(&"1212".chars().collect::<Vec<_>>()[..]), Diff::insert(&"".chars().collect::<Vec<_>>()[..]), - Diff::equal(&"wxyz".chars().collect::<Vec<_>>()[..]), + Diff::equal(&"wxyz".chars().collect::<Vec<_>>()[..]), ]; DiffMatchPatch::cleanup_semantic(&mut diffs); assert_eq!(test, diffs); - } #[test] diff --git a/tests/test.rs b/tests/test.rs index 35cd52d..4875c75 100644 --- a/tests/test.rs +++ b/tests/test.rs @@ -1362,7 +1362,7 @@ fn test_match_main() { #[test] fn test_patch_repeats_todo_import() -> Result<(), Error> { let dmp = DiffMatchPatch::default(); - + // Create source and target strings let source = r##"( import { useState, useEffect } from "react"; @@ -1480,25 +1480,25 @@ export default function App() { ); } )"##; - + // Create patches to transform source into target let patches = dmp.patch_make(PatchInput::Texts::<Efficient>(source, target))?; - + // Apply the patches to the source string let (patched, results) = dmp.patch_apply(&patches, source)?; - + // Verify all patches were applied successfully assert!(results.iter().all(|&result| result)); - + // Verify the patched string equals the target assert_eq!(target, patched); - + // Also test with Compat mode let patches_compat = dmp.patch_make(PatchInput::Texts::<Compat>(source, target))?; let (patched_compat, results_compat) = dmp.patch_apply(&patches_compat, source)?; - + assert!(results_compat.iter().all(|&result| result)); assert_eq!(target, patched_compat); - + Ok(()) } |