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 / rename.go
diff --git a/.config/coc/extensions/coc-go-data/tools/pkg/mod/golang.org/x/tools@v0.0.0-20201105173854-bc9fc8d8c4bc/internal/lsp/cmd/test/rename.go b/.config/coc/extensions/coc-go-data/tools/pkg/mod/golang.org/x/tools@v0.0.0-20201105173854-bc9fc8d8c4bc/internal/lsp/cmd/test/rename.go
new file mode 100644 (file)
index 0000000..0fe2d1e
--- /dev/null
@@ -0,0 +1,29 @@
+// Copyright 2019 The Go Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style
+// license that can be found in the LICENSE file.
+
+package cmdtest
+
+import (
+       "fmt"
+       "testing"
+
+       "golang.org/x/tools/internal/span"
+)
+
+func (r *runner) Rename(t *testing.T, spn span.Span, newText string) {
+       filename := spn.URI().Filename()
+       goldenTag := newText + "-rename"
+       loc := fmt.Sprintf("%v", spn)
+       got, err := r.NormalizeGoplsCmd(t, "rename", loc, newText)
+       got += err
+       expect := string(r.data.Golden(goldenTag, filename, func() ([]byte, error) {
+               return []byte(got), nil
+       }))
+       if expect != got {
+               t.Errorf("rename failed with %v %v\nexpected:\n%s\ngot:\n%s", loc, newText, expect, got)
+       }
+       // now check we can build a valid unified diff
+       unified, _ := r.NormalizeGoplsCmd(t, "rename", "-d", loc, newText)
+       checkUnified(t, filename, expect, unified)
+}