1 // Copyright 2020 The Go Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style
3 // license that can be found in the LICENSE file.
10 . "golang.org/x/tools/gopls/internal/regtest"
13 // This test passes (TestHoverOnError in definition_test.go) without
14 // the //line directive
15 func TestHoverFailure(t *testing.T) {
32 WithOptions(SkipLogs()).Run(t, mod, func(t *testing.T, env *Env) {
33 env.OpenFile("main.go")
34 content, _ := env.Hover("main.go", env.RegexpSearch("main.go", "Error"))
35 // without the //line comment content would be non-nil
37 t.Fatalf("expected nil hover content for Error")
42 // badPackageDup contains a duplicate definition of the 'a' const.
43 // this is from diagnostics_test.go,
44 const badPackageDup = `
59 func TestFailingDiagnosticClearingOnEdit(t *testing.T) {
60 Run(t, badPackageDup, func(t *testing.T, env *Env) {
62 // no diagnostics for any files, but there should be
63 env.Await(NoDiagnostics("a.go"), NoDiagnostics("b.go"))
65 // Fix the error by editing the const name in b.go to `b`.
66 env.RegexpReplace("b.go", "(a) = 2", "b")
68 // The diagnostics that weren't sent above should now be cleared.