|
4 | 4 |
|
5 | 5 | package completion |
6 | 6 |
|
| 7 | +// This file is misnamed; it has no version constraints. |
| 8 | +// TODO(adonovan): fold into completion_test.go |
| 9 | + |
7 | 10 | import ( |
8 | 11 | "testing" |
9 | 12 |
|
10 | 13 | "golang.org/x/tools/gopls/internal/protocol" |
11 | 14 | . "golang.org/x/tools/gopls/internal/test/integration" |
| 15 | + "golang.org/x/tools/internal/testenv" |
12 | 16 | ) |
13 | 17 |
|
14 | 18 | // test generic receivers |
@@ -52,13 +56,16 @@ func (s SyncMap[XX,string]) g(v UU) {} |
52 | 56 | } |
53 | 57 | }) |
54 | 58 | } |
| 59 | + |
55 | 60 | func TestFuzzFunc(t *testing.T) { |
| 61 | + testenv.NeedsGoCommand1Point(t, 25) // go1.25 added TBF.Attr |
| 62 | + |
56 | 63 | // use the example from the package documentation |
57 | 64 | modfile := ` |
58 | 65 | -- go.mod -- |
59 | 66 | module mod.com |
60 | 67 |
|
61 | | -go 1.18 |
| 68 | +go 1.25 |
62 | 69 | ` |
63 | 70 | part0 := `package foo |
64 | 71 | import "testing" |
@@ -90,28 +97,20 @@ func FuzzHex(f *testing.F) { |
90 | 97 | -- c_test.go -- |
91 | 98 | ` + part0 + part1 + part2 |
92 | 99 |
|
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 | | - |
98 | 100 | tests := []struct { |
99 | 101 | file string |
100 | 102 | pat string |
101 | 103 | offset uint32 // UTF16 length from the beginning of pat to what the user just typed |
102 | 104 | want []string |
103 | 105 | }{ |
104 | | - {"a_test.go", "f.Ad", 3, ad}, |
| 106 | + {"a_test.go", "f.Ad", 3, []string{"Add", "Attr"}}, |
105 | 107 | {"c_test.go", " f.F", 4, []string{"Failed"}}, |
106 | 108 | {"c_test.go", "f.N", 3, []string{"Name"}}, |
107 | 109 | {"b_test.go", "f.F", 3, []string{"Fuzz(func(t *testing.T, a []byte)", "Fail", "FailNow", |
108 | 110 | "Failed", "Fatal", "Fatalf"}}, |
109 | 111 | } |
110 | 112 | Run(t, data, func(t *testing.T, env *Env) { |
111 | 113 | 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 | | - } |
115 | 114 | env.OpenFile(test.file) |
116 | 115 | env.Await(env.DoneWithOpen()) |
117 | 116 | loc := env.RegexpSearch(test.file, test.pat) |
|
0 commit comments