From a70f2bc213fb73930180d21edc3162030878803c Mon Sep 17 00:00:00 2001 From: Rob Findley Date: Mon, 22 May 2023 16:57:52 -0400 Subject: [PATCH] gopls/internal/regtest/misc: update and unskip TestHoverIntLiteral 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 Reviewed-by: Alan Donovan gopls-CI: kokoro Auto-Submit: Robert Findley TryBot-Result: Gopher Robot --- gopls/internal/regtest/misc/hover_test.go | 10 ++-------- 1 file changed, 2 insertions(+), 8 deletions(-) diff --git a/gopls/internal/regtest/misc/hover_test.go b/gopls/internal/regtest/misc/hover_test.go index 24ee6d857d5..41c6529a7bf 100644 --- a/gopls/internal/regtest/misc/hover_test.go +++ b/gopls/internal/regtest/misc/hover_test.go @@ -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 @@ -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) }