gopls/internal/regtest: add a failing test for issue 44736
For golang/go#44736
Change-Id: I5c7cb83365d3542bb4a7cc391a68039fe81cf862
Reviewed-on: https://go-review.googlesource.com/c/tools/+/297870
Trust: Robert Findley <rfindley@google.com>
Run-TryBot: Robert Findley <rfindley@google.com>
gopls-CI: kokoro <noreply+kokoro@google.com>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Heschi Kreinick <heschi@google.com>
diff --git a/gopls/internal/regtest/diagnostics/diagnostics_test.go b/gopls/internal/regtest/diagnostics/diagnostics_test.go
index 00a7f58..dc5943a 100644
--- a/gopls/internal/regtest/diagnostics/diagnostics_test.go
+++ b/gopls/internal/regtest/diagnostics/diagnostics_test.go
@@ -1816,3 +1816,42 @@
})
}
+
+func TestIssue44736(t *testing.T) {
+ t.Skip("failing test - see golang.org/issues/44736")
+ const files = `
+ -- go.mod --
+module blah.com
+
+go 1.16
+-- main.go --
+package main
+
+import "fmt"
+
+func main() {
+ asdf
+ fmt.Printf("This is a test %v")
+ fdas
+}
+-- other.go --
+package main
+
+`
+ Run(t, files, func(t *testing.T, env *Env) {
+ env.OpenFile("main.go")
+ env.OpenFile("other.go")
+ env.Await(
+ env.DiagnosticAtRegexpWithMessage("main.go", "asdf", "undeclared name"),
+ env.DiagnosticAtRegexpWithMessage("main.go", "fdas", "undeclared name"),
+ )
+ env.SetBufferContent("other.go", "package main\n\nasdf")
+ // The new diagnostic in other.go should not suppress diagnostics in main.go.
+ env.Await(
+ OnceMet(
+ env.DiagnosticAtRegexpWithMessage("other.go", "asdf", "expected declaration"),
+ env.DiagnosticAtRegexpWithMessage("main.go", "asdf", "undeclared name"),
+ ),
+ )
+ })
+}