Closed findleyr closed 1 year ago
Change https://golang.org/cl/240059 mentions this issue: internal/lsp/regtest: use a common directory regtests sandboxes
Change https://golang.org/cl/240058 mentions this issue: internal/lsp/fake: explicitly set GOPACKAGESDRIVER=off in regtests
Change https://golang.org/cl/241739 mentions this issue: internal/lsp/regtest: refactor to use a different options pattern
Change https://golang.org/cl/243057 mentions this issue: internal/lsp/regtest: simpler way to invert options
Change https://golang.org/cl/252683 mentions this issue: integration/regtest: use gopls hooks and add a test for staticcheck
Change https://golang.org/cl/252682 mentions this issue: gopls/integration/regtest: move regtests to the gopls module
Change https://golang.org/cl/255126 mentions this issue: gopls/internal/regtest: simplify expectation return values
Change https://golang.org/cl/283512 mentions this issue: gopls/internal/regtest: fix synchronization for TestUseGoplsMod
Change https://golang.org/cl/287572 mentions this issue: gopls/internal/regtest: split regtests up into multiple packages
Change https://go.dev/cl/416876 mentions this issue: internal/lsp/regtest: simplify, consolidate, and document settings
Change https://go.dev/cl/417587 mentions this issue: internal/lsp/regtest: allow sharing memoized results across regtests
Change https://go.dev/cl/418774 mentions this issue: internal/lsp/regtest: only run /singleton tests with -short
Change https://go.dev/cl/461801 mentions this issue: gopls/internal/regtest: eliminate EmptyDiagnostics
Change https://go.dev/cl/461915 mentions this issue: gopls/internal/regtest: add a simpler API for diagnostic expectations
Change https://go.dev/cl/461916 mentions this issue: gopls/internal/regtest: eliminate GoSumDiagnostic
Change https://go.dev/cl/461917 mentions this issue: gopls/internal/regtest: simplify OnceMet expressions with an env helper
Change https://go.dev/cl/461935 mentions this issue: gopls/internal/lsp/fake: use protocol types for the fake editor
Change https://go.dev/cl/461936 mentions this issue: gopls/internal/regtest: replace NoDiagnostics with NoMatchingDiagnostics
Change https://go.dev/cl/461937 mentions this issue: gopls/internal/regtest: eliminate DiagnosticAt
Change https://go.dev/cl/461938 mentions this issue: gopls/internal/regtest: eliminate DiagnosticsAtRegexpWithMessage
Change https://go.dev/cl/461939 mentions this issue: gopls/internal/regtest: eliminate DiagnosticAtRegexp
Change https://go.dev/cl/461897 mentions this issue: gopls/internal/regtest: clean up workspace symbol helpers
Change https://go.dev/cl/462495 mentions this issue: gopls/internal/regtest: use AfterChange in more places
I think we've done enough here.
This is a follow-up to #36879. We've been using the gopls regtests for a few months now, and several usability bugs / missing features / overall themes have emerged. None of these seemed worthy of an issue, but I want to track them in aggregate. I've been trying to let the regtests soak in their current form, but plan to take another pass soon.
Here's a list of what I've noted along the way, either from my own usage or feedback from others'. Feel free to comment with more, and I'll edit this comment to keep it up to date.
-regtest_timeout
to avoid waiting for the default regtest timeout).runner.Run
is hard to spot. Use a different options pattern to allow passing them before the test body.go
command). Perhaps awaiting 'NoOutstandingWork' could help here.gopls
module, so that they can run staticcheck.gopls
module, replace the synthetic file watching with actual file watching, using fsnotify. The fact that file-watching is faked has been a source of bugs. The file watching should also respect the GlobPattern provided in the file watching capability registration.DiagnosticAtRegexp
expectation lazy, so that it doesn't eagerly evaluate the regexp position (and therefore no longer needs theEnv
receiver).DiagnosticAtRegexp
match the full range of the regexp match, not just the starting position (this was a cause of some confusion in a CL).State
from Await: whatever caused expectations to be be met~ (the underlying requirement was instead achieved with less effort by adding a 'ReadDiagnostics' expectation that atomically reads from State).GOPACKAGESDRIVER=off
for all regtests.TMPDIR
for the entire regtest suite, rather than letting each regtest create it's own sandbox in/tmp
. This reduces cruft in/tmp
when tests are ctrl-c'ed before they can clean themselves up.CC @pjweinbgo @stamblerre @heschik