go/internal/lsp/diff
Robert Findley 4ccc73cbb5 internal/lsp/tests: simplify comparison of markdown at go1.18
In several places throughout the x/tools codebase, the internal/lsp/diff
package is used to provide clearer test output when comparing large,
multi-line strings. In some places, this is implemented via the
tests.Diff helper function, but in others it is not (presumably due to
import cycles).

Factor out this pattern into a diff.Pretty function, and add commentary.
Also remove the *testing.T argument, as diffs should never fail; opt to
panic instead. Also add a test.

Using this function, simplify the logic to comparing our 1.18 markdown
output with 1.19 golden content, by normalizing differences between the
two.

This is necessary as markdown content will change as a result of moving
internal/lsp to gopls/internal/lsp.

For golang/go#54509

Change-Id: Ie1fea1091bbbeb49e00c4efa7e02707cafa415cc
Reviewed-on: https://go-review.googlesource.com/c/tools/+/426776
TryBot-Result: Gopher Robot <gobot@golang.org>
Run-TryBot: Robert Findley <rfindley@google.com>
gopls-CI: kokoro <noreply+kokoro@google.com>
Reviewed-by: Alan Donovan <adonovan@google.com>
2022-08-31 21:08:24 +00:00
..
difftest internal/span: eliminate TokenConverter 2022-06-01 19:19:15 +00:00
lcs internal/lsp/diff: new diff implementation to replace go-diff 2022-07-24 16:55:18 +00:00
myers internal/lsp, gopls: recover from go-diff panics 2020-12-17 16:56:54 +00:00
diff.go internal/span: eliminate TokenConverter 2022-06-01 19:19:15 +00:00
diff_test.go internal/lsp/diff: new diff implementation to replace go-diff 2022-07-24 16:55:18 +00:00
ndiff.go internal/lsp/diff: new diff implementation to replace go-diff 2022-07-24 16:55:18 +00:00
unified.go internal/lsp/tests: simplify comparison of markdown at go1.18 2022-08-31 21:08:24 +00:00