github.com/april1989/origin-go-tools@v0.0.32/internal/lsp/cmd/test/symbols.go (about)

     1  // Copyright 2019 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 cmdtest
     6  
     7  import (
     8  	"testing"
     9  
    10  	"github.com/april1989/origin-go-tools/internal/lsp/protocol"
    11  	"github.com/april1989/origin-go-tools/internal/span"
    12  )
    13  
    14  func (r *runner) Symbols(t *testing.T, uri span.URI, expectedSymbols []protocol.DocumentSymbol) {
    15  	filename := uri.Filename()
    16  	got, _ := r.NormalizeGoplsCmd(t, "symbols", filename)
    17  	expect := string(r.data.Golden("symbols", filename, func() ([]byte, error) {
    18  		return []byte(got), nil
    19  	}))
    20  	if expect != got {
    21  		t.Errorf("symbols failed for %s expected:\n%s\ngot:\n%s", filename, expect, got)
    22  	}
    23  }