golang.org/x/tools/gopls@v0.15.3/internal/test/integration/misc/call_hierarchy_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  package misc
     5  
     6  import (
     7  	"testing"
     8  
     9  	"golang.org/x/tools/gopls/internal/protocol"
    10  	. "golang.org/x/tools/gopls/internal/test/integration"
    11  )
    12  
    13  // Test for golang/go#49125
    14  func TestCallHierarchy_Issue49125(t *testing.T) {
    15  	const files = `
    16  -- go.mod --
    17  module mod.com
    18  
    19  go 1.12
    20  -- p.go --
    21  package pkg
    22  `
    23  	// TODO(rfindley): this could probably just be a marker test.
    24  	Run(t, files, func(t *testing.T, env *Env) {
    25  		env.OpenFile("p.go")
    26  		loc := env.RegexpSearch("p.go", "pkg")
    27  
    28  		var params protocol.CallHierarchyPrepareParams
    29  		params.TextDocument.URI = loc.URI
    30  		params.Position = loc.Range.Start
    31  
    32  		// Check that this doesn't panic.
    33  		env.Editor.Server.PrepareCallHierarchy(env.Ctx, &params)
    34  	})
    35  }