Skip to content

Commit 4ee8992

Browse files
neildgopherbot
authored andcommitted
gopls/internal/test/integration/completion: make test more go1.26-robust
Fix the name of the *testing.F function added in Go 1.26 (ArtifactDir, not Artifact), and sort it correctly. Do not modify the want list in compareCompletionLabels, which causes issues when a modified completion list is reused in a later test. Updates golang/go#74987 Change-Id: I2d380979c346283a3eeedeb979b3747280018c93 Reviewed-on: https://go-review.googlesource.com/c/tools/+/709635 Reviewed-by: Alan Donovan <adonovan@google.com> LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com> Auto-Submit: Damien Neil <dneil@google.com>
1 parent a03a1c2 commit 4ee8992

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -107,7 +107,7 @@ func FuzzHex(f *testing.F) {
107107
}{
108108
// To avoid breaking these assertions as the "testing" package evolves,
109109
// use an optional (?) suffix for newer symbols.
110-
{"a_test.go", "f.Ad", 3, []string{"Add", "Attr", "Artifact?"}}, // Attr is 1.25, Artifact is 1.26
110+
{"a_test.go", "f.Ad", 3, []string{"Add", "ArtifactDir?", "Attr"}}, // Attr is 1.25, Artifact is 1.26
111111
{"c_test.go", " f.F", 4, []string{"Failed"}},
112112
{"c_test.go", "f.N", 3, []string{"Name"}},
113113
{"b_test.go", "f.F", 3, []string{"Fuzz(func(t *testing.T, a []byte)", "Fail", "FailNow",

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -285,7 +285,7 @@ func compareCompletionLabels(want []string, gotItems []protocol.CompletionItem)
285285
// A 'want' item with a '?' suffix is optional, to ease
286286
// migration across versions. Remove any that are not present
287287
// in the 'got' set.
288-
out := want[:0] // in-place compaction
288+
var out []string
289289
for _, item := range want {
290290
item, optional := strings.CutSuffix(item, "?")
291291
if optional && !slices.Contains(got, item) {

0 commit comments

Comments
 (0)