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.
10 "golang.org/x/tools/internal/lsp/diff"
11 "golang.org/x/tools/internal/lsp/diff/myers"
12 "golang.org/x/tools/internal/span"
15 func (r *runner) Import(t *testing.T, spn span.Span) {
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
23 d := myers.ComputeEdits(uri, want, got)
24 t.Errorf("imports failed for %s, expected:\n%s", filename, diff.ToUnified("want", "got", want, d))