internal/lsp/regtest: reproduce empty xtest bug
packages.Load returns bad data for an empty xtest in GOPATH mode.
Updates golang/go#40825.
Change-Id: Ibab8dcbeafc22a71a2a4c3be0008b728c13c4c80
Reviewed-on: https://go-review.googlesource.com/c/tools/+/249703
Run-TryBot: Heschi Kreinick <heschi@google.com>
Reviewed-by: Robert Findley <rfindley@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
diff --git a/internal/lsp/regtest/diagnostics_test.go b/internal/lsp/regtest/diagnostics_test.go
index 57c355c..428da7a 100644
--- a/internal/lsp/regtest/diagnostics_test.go
+++ b/internal/lsp/regtest/diagnostics_test.go
@@ -835,6 +835,25 @@
})
}
+// Reproduces golang/go#40825.
+func TestEmptyGOPATHXTest_40825(t *testing.T) {
+ t.Skip("bug isn't fixed yet")
+ const files = `
+-- x.go --
+package x
+-- x_test.go --
+`
+
+ withOptions(InGOPATH()).run(t, files, func(t *testing.T, env *Env) {
+ env.OpenFile("x_test.go")
+ env.EditBuffer("x_test.go", fake.NewEdit(0, 0, 0, 0, "pack"))
+ env.Await(
+ CompletedWork(lsp.DiagnosticWorkTitle(lsp.FromDidChange), 1),
+ NoShowMessage(),
+ )
+ })
+}
+
func TestIgnoredFiles(t *testing.T) {
const ws = `
-- go.mod --