From a97598586c7fba61ede2cd6fa90eb6ca075443ca Mon Sep 17 00:00:00 2001 From: Mathias Date: Fri, 2 Oct 2026 08:56:53 +0200 Subject: [PATCH] test(reconcile): a span across a segment edge leaves neither segment holding a replaced word -- a mutation that skipped this survived Co-Authored-By: Claude Sonnet 5.5 --- internal/reconcile/reconcile_spots_test.go | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/internal/reconcile/reconcile_spots_test.go b/internal/reconcile/reconcile_spots_test.go index a3eba9b..bf4e6a4 100644 --- a/internal/reconcile/reconcile_spots_test.go +++ b/internal/reconcile/reconcile_spots_test.go @@ -118,3 +118,13 @@ func TestReconcileSegments_SegmentsThatDoNotLineUpWithTheTextAreLeftAsTheBases(t assert.Equal(t, base.Segments, out.Segments) assert.Equal(t, "a y b c", out.Text, "the merged text is unaffected") } + +func TestReconcileSegments_ASpanThatCrossesASegmentEdgeIsRemovedFromBothSegments(t *testing.T) { + base := segmented("a b c d", domain.Segment{Start: 0, End: 5, Text: "a b"}, domain.Segment{Start: 5, End: 10, Text: "c d"}) + + out := merge(t, base, tr("a X d"), always(reconcile.VerdictAlt)) + + require.Equal(t, "a X d", out.Text) + assert.Equal(t, "a X", out.Segments[0].Text) + assert.Equal(t, "d", out.Segments[1].Text, "'c' was replaced too: it must not linger in the second segment") +}