[tools] gopls/internal/test: Completion benchmarks use zerowidth range

0 views
Skip to first unread message

Alex Putman (Gerrit)

unread,
5:03 PM (1 hour ago) 5:03 PM
to goph...@pubsubhelper.golang.org, golang-...@googlegroups.com, golang...@luci-project-accounts.iam.gserviceaccount.com, Madeline Kalil, Alan Donovan, golang-co...@googlegroups.com

Alex Putman submitted the change with unreviewed changes

Unreviewed changes

1 is the latest approved patch-set.
The change was submitted with unreviewed changes in the following files:

```
The name of the file: gopls/internal/test/integration/bench/completion_test.go
Insertions: 6, Deletions: 6.

@@ -39,8 +39,8 @@

// Run a completion to make sure the system is warm.
loc := env.RegexpSearch(options.file, options.locationRegexp)
- if loc.Range.Start != loc.Range.End {
- b.Errorf("Completion locationRegexp only allows for zero width ranges, so use an empty regex group: ()")
+ if !loc.Range.Empty() {
+ b.Errorf("Completion locationRegexp only allows for empty ranges, so use an empty regex group: ()")
}
completions := env.Completion(loc)

@@ -308,8 +308,8 @@

// Run a completion to make sure the system is warm.
loc := env.RegexpSearch(test.file, test.locationRegexp)
- if loc.Range.Start != loc.Range.End {
- b.Errorf("Completion locationRegexp only allows for zero width ranges, so use an empty regex group: ()")
+ if !loc.Range.Empty() {
+ b.Errorf("Completion locationRegexp only allows for empty ranges, so use an empty regex group: ()")
}
loc.Range.End = loc.Range.Start
completions := env.Completion(loc)
@@ -330,8 +330,8 @@
editPlaceholder()
}
loc := env.RegexpSearch(test.file, test.locationRegexp)
- if loc.Range.Start != loc.Range.End {
- b.Errorf("Completion locationRegexp only allows for zero width ranges, so use an empty regex group: ()")
+ if !loc.Range.Empty() {
+ b.Errorf("Completion locationRegexp only allows for empty ranges, so use an empty regex group: ()")
}
env.Completion(loc)
}
```

Change information

Commit message:
gopls/internal/test: Completion benchmarks use empty range

CL 728881 enforced that gopls completions that pass a `Range` in the
TextDocumentPositionParams only do so with an empty range (start = end).
The benchmark tests weren't enforcing that, so many have been failing.

I fixed the failing tests and added a better error message to the test
code that encourages the regex string to only contain an empty group:
`()`.

Updates golang/go#80113
Change-Id: I1bdb82b4618e6c3eb04506eed93d81166a6a6964
Reviewed-by: Madeline Kalil <mka...@google.com>
Files:
  • M gopls/internal/test/integration/bench/completion_test.go
Change size: S
Delta: 1 file changed, 15 insertions(+), 5 deletions(-)
Branch: refs/heads/master
Submit Requirements:
Open in Gerrit
Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. DiffyGerrit
Gerrit-MessageType: merged
Gerrit-Project: tools
Gerrit-Branch: master
Gerrit-Change-Id: I1bdb82b4618e6c3eb04506eed93d81166a6a6964
Gerrit-Change-Number: 797720
Gerrit-PatchSet: 6
Gerrit-Owner: Alex Putman <apu...@golang.org>
Gerrit-Reviewer: Alex Putman <apu...@golang.org>
Gerrit-Reviewer: Madeline Kalil <mka...@google.com>
Gerrit-CC: Alan Donovan <adon...@google.com>
open
diffy
satisfied_requirement
Reply all
Reply to author
Forward
0 new messages