Skip to content

Commit 785cd66

Browse files
xieyuschengopherbot
authored andcommitted
gopls/internal/test/integration/completion: skip TestFuzzFunc pre-go1.25
This CL restricts TestFuzzFunc to go1.25 and simplifies accordingly. (That release added (*testing.F).Attr.) Fixes golang/go#74987 Change-Id: I900d9c362dbfdd5a5bdc266e28a3c680b1132e86 Reviewed-on: https://go-review.googlesource.com/c/tools/+/702075 Auto-Submit: Alan Donovan <adonovan@google.com> Reviewed-by: Robert Findley <rfindley@google.com> Reviewed-by: Xie Yuchen <xieyuschen@gmail.com> LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
1 parent ac2e4a5 commit 785cd66

File tree

1 file changed

+9
-10
lines changed

1 file changed

+9
-10
lines changed

gopls/internal/test/integration/completion/completion18_test.go

Lines changed: 9 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -4,11 +4,15 @@
44

55
package completion
66

7+
// This file is misnamed; it has no version constraints.
8+
// TODO(adonovan): fold into completion_test.go
9+
710
import (
811
"testing"
912

1013
"golang.org/x/tools/gopls/internal/protocol"
1114
. "golang.org/x/tools/gopls/internal/test/integration"
15+
"golang.org/x/tools/internal/testenv"
1216
)
1317

1418
// test generic receivers
@@ -52,13 +56,16 @@ func (s SyncMap[XX,string]) g(v UU) {}
5256
}
5357
})
5458
}
59+
5560
func TestFuzzFunc(t *testing.T) {
61+
testenv.NeedsGoCommand1Point(t, 25) // go1.25 added TBF.Attr
62+
5663
// use the example from the package documentation
5764
modfile := `
5865
-- go.mod --
5966
module mod.com
6067
61-
go 1.18
68+
go 1.25
6269
`
6370
part0 := `package foo
6471
import "testing"
@@ -90,28 +97,20 @@ func FuzzHex(f *testing.F) {
9097
-- c_test.go --
9198
` + part0 + part1 + part2
9299

93-
ad := []string{"Add"}
94-
if _, ok := any(t).(interface{ Attr(k, v string) }); ok { // go1.25 added TBF.Attr
95-
ad = append(ad, "Attr")
96-
}
97-
98100
tests := []struct {
99101
file string
100102
pat string
101103
offset uint32 // UTF16 length from the beginning of pat to what the user just typed
102104
want []string
103105
}{
104-
{"a_test.go", "f.Ad", 3, ad},
106+
{"a_test.go", "f.Ad", 3, []string{"Add", "Attr"}},
105107
{"c_test.go", " f.F", 4, []string{"Failed"}},
106108
{"c_test.go", "f.N", 3, []string{"Name"}},
107109
{"b_test.go", "f.F", 3, []string{"Fuzz(func(t *testing.T, a []byte)", "Fail", "FailNow",
108110
"Failed", "Fatal", "Fatalf"}},
109111
}
110112
Run(t, data, func(t *testing.T, env *Env) {
111113
for _, test := range tests {
112-
if test.file == "a_test.go" {
113-
t.Skip("go.dev/issue/74987: needs updating to pass after CL 695417")
114-
}
115114
env.OpenFile(test.file)
116115
env.Await(env.DoneWithOpen())
117116
loc := env.RegexpSearch(test.file, test.pat)

0 commit comments

Comments
 (0)