x/tools/gopls: add a skipped test for renaming of package

This adds a test that asserts that gopls gracefully recovers from a bad package
name. It does not include the fix for the test, and so this test is skipped: I
took a stab at it but it was a deep spelunk that I wasn't able to make enough
progress on.

Updates golang/go#41061

Change-Id: I86d817396dae5b0211e633721867e811c7d6cf40
Reviewed-on: https://go-review.googlesource.com/c/tools/+/262019
Run-TryBot: Jean de Klerk <deklerk@google.com>
gopls-CI: kokoro <noreply+kokoro@google.com>
TryBot-Result: Go Bot <gobot@golang.org>
Trust: Jean de Klerk <deklerk@google.com>
Reviewed-by: Rebecca Stambler <rstambler@golang.org>
diff --git a/gopls/internal/regtest/diagnostics_test.go b/gopls/internal/regtest/diagnostics_test.go
index 9d652e1..394c5a75 100644
--- a/gopls/internal/regtest/diagnostics_test.go
+++ b/gopls/internal/regtest/diagnostics_test.go
@@ -1427,3 +1427,28 @@
 		)
 	})
 }
+
+// When foo_test.go is opened, gopls will object to the borked package name.
+// This test asserts that when the package name is fixed, gopls will soon after
+// have no more complaints about it.
+// https://github.com/golang/go/issues/41061
+func TestRenamePackage(t *testing.T) {
+	t.Skip("Waiting for the fix that makes this pass: https://github.com/golang/go/issues/41061")
+
+	const contents = `
+-- go.mod --
+module mod.com
+-- foo.go --
+package foo
+-- foo_test.go --
+package foo_`
+
+	runner.Run(t, contents, func(t *testing.T, env *Env) {
+		env.OpenFile("foo_test.go")
+		env.RegexpReplace("foo_test.go", "foo_", "foo_test")
+		env.SaveBuffer("foo_test.go")
+		env.Await(
+			EmptyDiagnostics("foo_test.go"),
+		)
+	})
+}