()
| 1051 | |
| 1052 | #[test] |
| 1053 | fn test_word_diff_replacement() { |
| 1054 | let result = word_diff(b"const x = 1;", b"const x = 2;"); |
| 1055 | assert!(result.has_changes()); |
| 1056 | |
| 1057 | // The number 1 should be replaced with 2 |
| 1058 | let has_replace_or_del_ins = result |
| 1059 | .ops() |
| 1060 | .iter() |
| 1061 | .any(|op| op.is_replace() || op.is_delete() || op.is_insert()); |
| 1062 | assert!(has_replace_or_del_ins); |
| 1063 | } |
| 1064 | |
| 1065 | #[test] |
| 1066 | fn test_word_diff_edit_distance() { |