go/internal/diff/difftest
Alan Donovan a410e98a82 internal/diff: ToUnified may fail
LineEdits has similar consistency preconditions to ApplyEdits.
Previously they were assumed, and bad input would create bad
output or crashes; now it uses the same validation logic
as ApplyEdits. Since it reports an error, computation of a
unified diff can also fail if the edits are inconsistent.

The ToUnified([]Edit) function now returns an error. For
convenience we also provide a wrapper (Unified) that cannot
fail since it calls Strings and ToUnified consistently.

LineEdits itself is now private.

Change-Id: I3780827f501d7d5c9665ec8be5656331c0dcda8e
Reviewed-on: https://go-review.googlesource.com/c/tools/+/440175
Reviewed-by: Robert Findley <rfindley@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Run-TryBot: Alan Donovan <adonovan@google.com>
Auto-Submit: Alan Donovan <adonovan@google.com>
2022-10-07 15:16:55 +00:00
..
difftest.go internal/diff: ToUnified may fail 2022-10-07 15:16:55 +00:00
difftest_test.go internal/diff: simplify API, break span dependency 2022-10-05 20:32:15 +00:00