()
| 499 | |
| 500 | #[test] |
| 501 | fn auto_merge_non_overlapping_edits() { |
| 502 | let mut txn = MockTxn::new(); |
| 503 | let store = MemoryChangeStore::new(); |
| 504 | |
| 505 | // Base content: "host: localhost, port: 3000" |
| 506 | let base_hash = make_change(&store, b"host: localhost, port: 3000"); |
| 507 | let base_id = NodeId::new(1); |
| 508 | txn.register(base_id, base_hash); |
| 509 | |
| 510 | // Left changes host: "host: production, port: 3000" |
| 511 | let left_hash = make_change(&store, b"host: production, port: 3000"); |
| 512 | let left_id = NodeId::new(2); |
| 513 | txn.register(left_id, left_hash); |
| 514 | |
| 515 | // Right changes port: "host: localhost, port: 8080" |
| 516 | let right_hash = make_change(&store, b"host: localhost, port: 8080"); |
| 517 | let right_id = NodeId::new(3); |
| 518 | txn.register(right_id, right_hash); |
| 519 | |
| 520 | let engine = SemanticMergeEngine::new(&txn, &store); |
| 521 | |
| 522 | let v_base = GraphNode::new(base_id, ChangePosition::new(0), ChangePosition::new(27)); |
| 523 | let v_left = GraphNode::new(left_id, ChangePosition::new(0), ChangePosition::new(28)); |
| 524 | let v_right = GraphNode::new(right_id, ChangePosition::new(0), ChangePosition::new(27)); |
| 525 | |
| 526 | let group = ConflictGroup::new(vec![v_left, v_right]).with_ancestor(v_base); |
| 527 | let outcome = engine.try_merge(&group).unwrap(); |
| 528 | |
| 529 | assert!( |
| 530 | outcome.is_auto_merged(), |
| 531 | "expected AutoMerged, got {:?}", |
| 532 | outcome, |
| 533 | ); |
| 534 | assert_eq!( |
| 535 | std::str::from_utf8(outcome.content()).unwrap(), |
| 536 | "host: production, port: 8080", |
| 537 | ); |
| 538 | } |
| 539 | |
| 540 | // ---- SemanticMergeEngine: conflict on same token ----------------------- |
| 541 |
nothing calls this directly
no test coverage detected