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 / imports.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         "testing"
9
10         "golang.org/x/tools/internal/lsp/diff"
11         "golang.org/x/tools/internal/lsp/diff/myers"
12         "golang.org/x/tools/internal/span"
13 )
14
15 func (r *runner) Import(t *testing.T, spn span.Span) {
16         uri := spn.URI()
17         filename := uri.Filename()
18         got, _ := r.NormalizeGoplsCmd(t, "imports", filename)
19         want := string(r.data.Golden("goimports", filename, func() ([]byte, error) {
20                 return []byte(got), nil
21         }))
22         if want != got {
23                 d := myers.ComputeEdits(uri, want, got)
24                 t.Errorf("imports failed for %s, expected:\n%s", filename, diff.ToUnified("want", "got", want, d))
25         }
26 }