mirror of
https://github.com/golang/go
synced 2024-11-18 17:04:41 -07:00
internal/lsp/tests: add error handling for @item()
If there are less than 3 args for @item, it does an early return without recording it for a given pos. This leads to a panic when tests runner can't lookup a non-nil item for a pos. Since other collect* methods seem to use t.Fatal for error handling, do the same in collectCompletionItems(). Change-Id: I21960731f532b93029e6e06800e0484dc7d599df Reviewed-on: https://go-review.googlesource.com/c/tools/+/211257 Run-TryBot: Iskander Sharipov <quasilyte@gmail.com> Run-TryBot: Rebecca Stambler <rstambler@golang.org> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Rebecca Stambler <rstambler@golang.org>
This commit is contained in:
parent
7093a17b04
commit
27b81bef4a
@ -762,7 +762,9 @@ func (data *Data) collectCompletions(typ CompletionTestType) func(span.Span, []t
|
||||
|
||||
func (data *Data) collectCompletionItems(pos token.Pos, args []string) {
|
||||
if len(args) < 3 {
|
||||
return
|
||||
loc := data.Exported.ExpectFileSet.Position(pos)
|
||||
data.t.Fatalf("%s:%d: @item expects at least 3 args, got %d",
|
||||
loc.Filename, loc.Line, len(args))
|
||||
}
|
||||
label, detail, kind := args[0], args[1], args[2]
|
||||
var documentation string
|
||||
|
Loading…
Reference in New Issue
Block a user