Giant blob of minor changes
[dotfiles/.git] / .config / coc / extensions / coc-go-data / tools / pkg / mod / golang.org / x / tools@v0.0.0-20201105173854-bc9fc8d8c4bc / internal / lsp / cmd / test / links.go
1 // Copyright 2019 The Go Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style
3 // license that can be found in the LICENSE file.
4
5 package cmdtest
6
7 import (
8         "encoding/json"
9         "testing"
10
11         "golang.org/x/tools/internal/lsp/protocol"
12         "golang.org/x/tools/internal/lsp/tests"
13         "golang.org/x/tools/internal/span"
14 )
15
16 func (r *runner) Link(t *testing.T, uri span.URI, wantLinks []tests.Link) {
17         m, err := r.data.Mapper(uri)
18         if err != nil {
19                 t.Fatal(err)
20         }
21         out, _ := r.NormalizeGoplsCmd(t, "links", "-json", uri.Filename())
22         var got []protocol.DocumentLink
23         err = json.Unmarshal([]byte(out), &got)
24         if err != nil {
25                 t.Fatal(err)
26         }
27         if diff := tests.DiffLinks(m, wantLinks, got); diff != "" {
28                 t.Error(diff)
29         }
30 }