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.
12 // This test passes (TestHoverOnError in definition_test.go) without
13 // the //line directive
14 func TestHoverFailure(t *testing.T) {
29 withOptions(SkipLogs()).run(t, mod, func(t *testing.T, env *Env) {
30 env.OpenFile("main.go")
31 content, _ := env.Hover("main.go", env.RegexpSearch("main.go", "Error"))
32 // without the //line comment content would be non-nil
34 t.Fatalf("expected nil hover content for Error")
39 // badPackageDup contains a duplicate definition of the 'a' const.
40 // this is from diagnostics_test.go,
41 const badPackageDup = `
54 func TestFailingDiagnosticClearingOnEdit(t *testing.T) {
55 runner.Run(t, badPackageDup, func(t *testing.T, env *Env) {
56 log.SetFlags(log.Lshortfile)
58 env.Await(env.AnyDiagnosticAtCurrentVersion("a.go"))
59 // no diagnostics for either b.go or 'gen.go', but there should be
60 env.Await(NoDiagnostics("b.go"))
62 // Fix the error by editing the const name in b.go to `b`.
63 env.RegexpReplace("b.go", "(a) = 2", "b")
65 EmptyDiagnostics("a.go"),
66 // expected, as there have never been any diagnostics for b.go
67 NoDiagnostics("b.go"),