Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
gopls/internal/regtest: add a regtest-based version of the marker tests
Add a new implementation of the gopls marker tests that shares the same testing environment as the regression tests. Along the way, revisit the semantics of the marker framework, to address some problems we've identified over the years. Specifically: - Split tests into self-contained txtar encoded files. Each file determines an isolated set of markers, and is executed in a separate session. - Change the mechanisms for golden content, so that it is joined by identifiers, and passed to the test method as an argument. This makes it more apparent where golden content is used, and makes the identity of golden content stable under manipulations of the source (as opposed to some arbitrary munging of the note position) - Allow custom argument conversion that may be convenient for LSP-based test functions, by avoiding the packagestest framework and instead building directly on top of the x/tools/go/expect package. As an initial proof of concept, this allowed using a protocol.Location as a test method argument. - Add significant documentation and examples. - Deprecate the @hover marker in the old marker tests (gopls/internal/lsp). I believe that this lays the foundation to address the remaining concerns enumerated in golang/go#54845, as this new design solves the isolation problem, the problem of golden file naming, and the lack of clarity around the definition and construction of test annotations. For golang/go#54845 Change-Id: I796f35c14370b9651316baa1f86c21c63cec25c7 Reviewed-on: https://go-review.googlesource.com/c/tools/+/465255 TryBot-Result: Gopher Robot <[email protected]> Reviewed-by: Alan Donovan <[email protected]> Run-TryBot: Robert Findley <[email protected]> gopls-CI: kokoro <[email protected]>
- Loading branch information