golang.org/x/tools/gopls@v0.15.3/internal/test/integration/diagnostics/builtin_test.go (about)

     1  // Copyright 2021 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.
     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.GoToDefinition(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  }