()
| 341 | |
| 342 | #[test] |
| 343 | fn test_operations_have_correct_positions() { |
| 344 | let old = lines(&["a\n", "b\n", "c\n"]); |
| 345 | let new = lines(&["a\n", "x\n", "c\n"]); |
| 346 | |
| 347 | let result = diff(&old, &new); |
| 348 | |
| 349 | // Find the change operation |
| 350 | let changes: Vec<_> = result.changes().collect(); |
| 351 | assert_eq!(changes.len(), 1); |
| 352 | |
| 353 | // The change should be at position 1 (second line) |
| 354 | let change = changes[0]; |
| 355 | assert_eq!(change.old_range().start, 1); |
| 356 | } |
| 357 | |
| 358 | #[test] |
| 359 | fn test_edit_distance() { |