Skip to content

Commit

Permalink
gopls/internal/regtest/misc: update and unskip TestHoverIntLiteral
Browse files Browse the repository at this point in the history
This test is updated to exercise hover over literals, not vars, as was
decided in golang/go#58220.

Updates golang/go#53878

Change-Id: Ic70d3492f28580ebfea24ec08dc47b1ad385c2ff
Reviewed-on: https://go-review.googlesource.com/c/tools/+/496885
Run-TryBot: Robert Findley <rfindley@google.com>
Reviewed-by: Alan Donovan <adonovan@google.com>
gopls-CI: kokoro <noreply+kokoro@google.com>
Auto-Submit: Robert Findley <rfindley@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
  • Loading branch information
findleyr committed May 22, 2023
1 parent 6997d19 commit a70f2bc
Showing 1 changed file with 2 additions and 8 deletions.
10 changes: 2 additions & 8 deletions gopls/internal/regtest/misc/hover_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -84,12 +84,6 @@ func main() {
}

func TestHoverIntLiteral(t *testing.T) {
// TODO(rfindley): this behavior doesn't actually make sense for vars. It is
// misleading to format their value when it is (of course) variable.
//
// Instead, we should allow hovering on numeric literals.
t.Skip("golang/go#58220: broken due to new hover logic")

const source = `
-- main.go --
package main
Expand All @@ -106,13 +100,13 @@ func main() {
Run(t, source, func(t *testing.T, env *Env) {
env.OpenFile("main.go")
hexExpected := "58190"
got, _ := env.Hover(env.RegexpSearch("main.go", "hex"))
got, _ := env.Hover(env.RegexpSearch("main.go", "0xe"))
if got != nil && !strings.Contains(got.Value, hexExpected) {
t.Errorf("Hover: missing expected field '%s'. Got:\n%q", hexExpected, got.Value)
}

binExpected := "73"
got, _ = env.Hover(env.RegexpSearch("main.go", "bigBin"))
got, _ = env.Hover(env.RegexpSearch("main.go", "0b1"))
if got != nil && !strings.Contains(got.Value, binExpected) {
t.Errorf("Hover: missing expected field '%s'. Got:\n%q", binExpected, got.Value)
}
Expand Down

0 comments on commit a70f2bc

Please sign in to comment.