Skip to content

Commit

Permalink
gopls/internal/test/integration: add regtest for hover crash
Browse files Browse the repository at this point in the history
This CL adds a test that confirms the bug reported in
golang/go#60592 is fixed at master; the test fails at
commit 87ad891.

Fixes golang/go#60592

Change-Id: Id9436d019a782a385228f77ce92988005711e700
Reviewed-on: https://go-review.googlesource.com/c/tools/+/557715
Reviewed-by: Robert Findley <rfindley@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Auto-Submit: Alan Donovan <adonovan@google.com>
  • Loading branch information
adonovan authored and gopherbot committed Jan 23, 2024
1 parent bd547e5 commit c16e222
Showing 1 changed file with 23 additions and 0 deletions.
23 changes: 23 additions & 0 deletions gopls/internal/test/integration/misc/hover_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -491,3 +491,26 @@ func TestHoverEmbedDirective(t *testing.T) {
}
})
}

func TestHoverBrokenImport_Issue60592(t *testing.T) {
const files = `
-- go.mod --
module testdata
go 1.18
-- p.go --
package main
import foo "a"
func _() {
foo.Print()
}
`
Run(t, files, func(t *testing.T, env *Env) {
env.OpenFile("p.go")
// This request should not crash gopls.
_, _, _ = env.Editor.Hover(env.Ctx, env.RegexpSearch("p.go", "foo[.]"))
})
}

0 comments on commit c16e222

Please sign in to comment.