From 3366bbee4705eb8731ba07209ab5858d9742d44e Mon Sep 17 00:00:00 2001 From: Heschi Kreinick Date: Fri, 21 Aug 2020 15:10:18 -0400 Subject: [PATCH] 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 Reviewed-by: Robert Findley TryBot-Result: Gobot Gobot --- internal/lsp/regtest/diagnostics_test.go | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/internal/lsp/regtest/diagnostics_test.go b/internal/lsp/regtest/diagnostics_test.go index 57c355c0e8..428da7a1f1 100644 --- a/internal/lsp/regtest/diagnostics_test.go +++ b/internal/lsp/regtest/diagnostics_test.go @@ -835,6 +835,25 @@ func TestHello(t *testing.T) { }) } +// 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 --