()
| 611 | |
| 612 | #[test] |
| 613 | fn auto_merge_non_overlapping_edits() { |
| 614 | let mut txn = MockTxn::new(); |
| 615 | let store = MemoryChangeStore::new(); |
| 616 | |
| 617 | // Base content: "host: localhost, port: 3000" |
| 618 | let base_hash = make_change(&store, b"host: localhost, port: 3000"); |
| 619 | let base_id = NodeId::new(1); |
| 620 | txn.register(base_id, base_hash); |
| 621 | |
| 622 | // Left changes host: "host: production, port: 3000" |
| 623 | let left_hash = make_change(&store, b"host: production, port: 3000"); |
| 624 | let left_id = NodeId::new(2); |
| 625 | txn.register(left_id, left_hash); |
| 626 | |
| 627 | // Right changes port: "host: localhost, port: 8080" |
| 628 | let right_hash = make_change(&store, b"host: localhost, port: 8080"); |
| 629 | let right_id = NodeId::new(3); |
| 630 | txn.register(right_id, right_hash); |
| 631 | |
| 632 | let engine = SemanticMergeEngine::new(&txn, &store); |
| 633 | |
| 634 | let v_base = GraphNode::new(base_id, ChangePosition::new(0), ChangePosition::new(27)); |
| 635 | let v_left = GraphNode::new(left_id, ChangePosition::new(0), ChangePosition::new(28)); |
| 636 | let v_right = GraphNode::new(right_id, ChangePosition::new(0), ChangePosition::new(27)); |
| 637 | |
| 638 | let group = ConflictGroup::new(vec![v_left, v_right]).with_ancestor(v_base); |
| 639 | let outcome = engine.try_merge(&group).unwrap(); |
| 640 | |
| 641 | assert!( |
| 642 | outcome.is_auto_merged(), |
| 643 | "expected AutoMerged, got {:?}", |
| 644 | outcome, |
| 645 | ); |
| 646 | assert_eq!( |
| 647 | std::str::from_utf8(outcome.content()).unwrap(), |
| 648 | "host: production, port: 8080", |
| 649 | ); |
| 650 | } |
| 651 | |
| 652 | // ---- SemanticMergeEngine: conflict on same token ----------------------- |
| 653 |
nothing calls this directly
no test coverage detected