Skip to content
This repository has been archived by the owner on Oct 12, 2022. It is now read-only.

Commit

Permalink
Only test if godef to GOROOT matches path
Browse files Browse the repository at this point in the history
  • Loading branch information
keegancsmith committed Feb 13, 2018
1 parent 4935ba8 commit 3247dad
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion langserver/langserver_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -449,7 +449,7 @@ package main; import "test/pkg"; func B() { p.A(); B() }`,
// "a.go:1:53": "type int int",
},
overrideGodefDefinition: map[string]string{
"a.go:1:40": "/goroot/src/fmt/print.go:256:6-256:13", // hitting the real GOROOT
"a.go:1:40": "/goroot/src/fmt/print.go", // hitting the real GOROOT
"a.go:1:53": "/goroot/src/builtin/builtin.go:1:1-1:1", // TODO: accurate builtin positions
},
wantDefinition: map[string]string{
Expand Down Expand Up @@ -1389,6 +1389,12 @@ func definitionTest(t testing.TB, ctx context.Context, c *jsonrpc2.Conn, rootURI
definition = strings.TrimPrefix(definition, util.UriToPath(util.PathToURI(trimPrefix)))
}
}
if !strings.Contains(want, ":") {
// our want is just a path, so we only check that matches. This is
// used by our godef tests into GOROOT. The GOROOT changes over time,
// but the file for a symbol is usually pretty stable.
definition = strings.Split(definition, ":")[0]
}
if definition != want {
t.Errorf("got %q, want %q", definition, want)
}
Expand Down

0 comments on commit 3247dad

Please sign in to comment.