| 1 |
|
| 2 |
|
| 3 |
|
| 4 |
|
| 5 |
package diagnostics |
| 6 |
|
| 7 |
import ( |
| 8 |
"strings" |
| 9 |
"testing" |
| 10 |
|
| 11 |
. "golang.org/x/tools/gopls/internal/test/integration" |
| 12 |
) |
| 13 |
|
| 14 |
func TestIssue44866(t *testing.T) { |
| 15 |
src := ` |
| 16 |
-- go.mod -- |
| 17 |
module mod.com |
| 18 |
|
| 19 |
go 1.12 |
| 20 |
-- a.go -- |
| 21 |
package a |
| 22 |
|
| 23 |
const ( |
| 24 |
c = iota |
| 25 |
) |
| 26 |
` |
| 27 |
Run(t, src, func(t *testing.T, env *Env) { |
| 28 |
env.OpenFile("a.go") |
| 29 |
loc := env.FirstDefinition(env.RegexpSearch("a.go", "iota")) |
| 30 |
if !strings.HasSuffix(string(loc.URI), "builtin.go") { |
| 31 |
t.Fatalf("jumped to %q, want builtin.go", loc.URI) |
| 32 |
} |
| 33 |
env.AfterChange(NoDiagnostics(ForFile("builtin.go"))) |
| 34 |
}) |
| 35 |
} |