gopls: add test for `go mod tidy` diagnostics in multiple modules

Just a simple test that confirms that diagnostics work in multi module
mode. There are still a lot of edge cases with interdependent modules
that should be covered.

Change-Id: I3a489071346d3fce12b21c48a727ca1db4cfc57e
Reviewed-on: https://go-review.googlesource.com/c/tools/+/259140
Trust: Rebecca Stambler <rstambler@golang.org>
Run-TryBot: Rebecca Stambler <rstambler@golang.org>
gopls-CI: kokoro <noreply+kokoro@google.com>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Robert Findley <rfindley@google.com>
diff --git a/gopls/internal/regtest/modfile_test.go b/gopls/internal/regtest/modfile_test.go
index f1c84ab..71e8729 100644
--- a/gopls/internal/regtest/modfile_test.go
+++ b/gopls/internal/regtest/modfile_test.go
@@ -607,3 +607,42 @@
 		)
 	})
 }
+
+func TestMultiModuleModDiagnostics(t *testing.T) {
+	testenv.NeedsGo1Point(t, 14)
+
+	const mod = `
+-- a/go.mod --
+module mod.com
+
+go 1.14
+
+require (
+	example.com v1.2.3
+)
+-- a/main.go --
+package main
+
+func main() {}
+-- b/go.mod --
+module mod.com
+
+go 1.14
+-- b/main.go --
+package main
+
+import "example.com/blah"
+
+func main() {
+	blah.SaySomething()
+}
+`
+	withOptions(
+		WithProxyFiles(workspaceProxy),
+	).run(t, mod, func(t *testing.T, env *Env) {
+		env.Await(
+			env.DiagnosticAtRegexp("a/go.mod", "example.com v1.2.3"),
+			env.DiagnosticAtRegexp("b/go.mod", "module mod.com"),
+		)
+	})
+}