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") +}