1 // Copyright 2020 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/gopls/internal/regtest"
13 func TestStdlibReferences(t *testing.T) {
29 Run(t, files, func(t *testing.T, env *Env) {
30 env.OpenFile("main.go")
31 file, pos := env.GoToDefinition("main.go", env.RegexpSearch("main.go", `fmt.(Print)`))
32 refs, err := env.Editor.References(env.Ctx, file, pos)
37 t.Fatalf("got %v reference(s), want 2", len(refs))
39 // The first reference is guaranteed to be the definition.
40 if got, want := refs[1].URI, env.Sandbox.Workdir.URI("main.go"); got != want {
41 t.Errorf("found reference in %v, wanted %v", got, want)