import "golang.org/x/tools/internal/lsp/tests"
Package tests exports functionality to be used across a variety of gopls tests.
normalizer.go tests.go util.go
const ( // Default runs the standard completion tests. CompletionDefault = CompletionTestType(iota) // Unimported tests the autocompletion of unimported packages. CompletionUnimported // Deep tests deep completion. CompletionDeep // Fuzzy tests deep completion and fuzzy matching. CompletionFuzzy // CaseSensitive tests case sensitive completion. CompletionCaseSensitive // CompletionRank candidates in test must be valid and in the right relative order. CompletionRank )
const ( // Default runs the standard workspace symbols tests. WorkspaceSymbolsDefault = WorkspaceSymbolsTestType(iota) // Fuzzy tests workspace symbols with fuzzy matching. WorkspaceSymbolsFuzzy // CaseSensitive tests workspace symbols with case sensitive. WorkspaceSymbolsCaseSensitive )
func CheckCompletionOrder(want, got []protocol.CompletionItem, strictScores bool) string
func DiffCallHierarchyItems(gotCalls []protocol.CallHierarchyItem, expectedCalls []protocol.CallHierarchyItem) string
DiffCallHierarchyItems returns the diff between expected and actual call locations for incoming/outgoing call hierarchies
func DiffCompletionItems(want, got []protocol.CompletionItem) string
DiffCompletionItems prints the diff between expected and actual completion test results.
DiffDiagnostics prints the diff between expected and actual diagnostics test results.
func DiffLinks(mapper *protocol.ColumnMapper, wantLinks []Link, gotLinks []protocol.DocumentLink) string
DiffLinks takes the links we got and checks if they are located within the source or a Note. If the link is within a Note, the link is removed. Returns an diff comment if there are differences and empty string if no diffs.
func DiffSnippets(want string, got *protocol.CompletionItem) string
DiffSymbols prints the diff between expected and actual symbols test results.
func FilterBuiltins(src span.Span, items []protocol.CompletionItem) []protocol.CompletionItem
func FindItem(list []protocol.CompletionItem, want completion.CompletionItem) *protocol.CompletionItem
func Normalize(s string, normalizers []Normalizer) string
Normalize replaces all paths present in s with just the fragment portion this is used to make golden files not depend on the temporary paths of the files
func NormalizePrefix(s string, normalizers []Normalizer) string
NormalizePrefix normalizes a single path at the front of the input string.
func ToProtocolCompletionItem(item completion.CompletionItem) protocol.CompletionItem
func ToProtocolCompletionItems(items []completion.CompletionItem) []protocol.CompletionItem
func WorkspaceSymbolsString(ctx context.Context, data *Data, queryURI span.URI, symbols []protocol.SymbolInformation) (string, error)
func WorkspaceSymbolsTestTypeToMatcher(typ WorkspaceSymbolsTestType) source.SymbolMatcher
type CallHierarchy map[span.Span]*CallHierarchyResult
type CallHierarchyResult struct { IncomingCalls, OutgoingCalls []protocol.CallHierarchyItem }
type CaseSensitiveCompletions map[span.Span][]Completion
type CompletionItems map[token.Pos]*completion.CompletionItem
type CompletionSnippet struct { CompletionItem token.Pos PlainSnippet string PlaceholderSnippet string }
type CompletionSnippets map[span.Span][]CompletionSnippet
type Completions map[span.Span][]Completion
type Data struct { Config packages.Config Exported *packagestest.Exported CallHierarchy CallHierarchy CodeLens CodeLens Diagnostics Diagnostics CompletionItems CompletionItems Completions Completions CompletionSnippets CompletionSnippets UnimportedCompletions UnimportedCompletions DeepCompletions DeepCompletions FuzzyCompletions FuzzyCompletions CaseSensitiveCompletions CaseSensitiveCompletions RankCompletions RankCompletions FoldingRanges FoldingRanges Formats Formats Imports Imports SemanticTokens SemanticTokens SuggestedFixes SuggestedFixes FunctionExtractions FunctionExtractions Definitions Definitions Implementations Implementations Highlights Highlights References References Renames Renames PrepareRenames PrepareRenames Symbols Symbols WorkspaceSymbols WorkspaceSymbols Signatures Signatures Links Links ModfileFlagAvailable bool // contains filtered or unexported fields }
type DeepCompletions map[span.Span][]Completion
type Definitions map[span.Span]Definition
type Diagnostics map[span.URI][]*source.Diagnostic
type FuzzyCompletions map[span.Span][]Completion
type Normalizer struct {
// contains filtered or unexported fields
}
func CollectNormalizers(exported *packagestest.Exported) []Normalizer
type PrepareRenames map[span.Span]*source.PrepareItem
type RankCompletions map[span.Span][]Completion
type Signatures map[span.Span]*protocol.SignatureHelp
type SymbolInformation map[span.Span]protocol.SymbolInformation
type Symbols map[span.URI][]protocol.DocumentSymbol
type SymbolsChildren map[string][]protocol.DocumentSymbol
type Tests interface { CallHierarchy(*testing.T, span.Span, *CallHierarchyResult) CodeLens(*testing.T, span.URI, []protocol.CodeLens) Diagnostics(*testing.T, span.URI, []*source.Diagnostic) Completion(*testing.T, span.Span, Completion, CompletionItems) CompletionSnippet(*testing.T, span.Span, CompletionSnippet, bool, CompletionItems) UnimportedCompletion(*testing.T, span.Span, Completion, CompletionItems) DeepCompletion(*testing.T, span.Span, Completion, CompletionItems) FuzzyCompletion(*testing.T, span.Span, Completion, CompletionItems) CaseSensitiveCompletion(*testing.T, span.Span, Completion, CompletionItems) RankCompletion(*testing.T, span.Span, Completion, CompletionItems) FoldingRanges(*testing.T, span.Span) Format(*testing.T, span.Span) Import(*testing.T, span.Span) SemanticTokens(*testing.T, span.Span) SuggestedFix(*testing.T, span.Span, []string, int) FunctionExtraction(*testing.T, span.Span, span.Span) Definition(*testing.T, span.Span, Definition) Implementation(*testing.T, span.Span, []span.Span) Highlight(*testing.T, span.Span, []span.Span) References(*testing.T, span.Span, []span.Span) Rename(*testing.T, span.Span, string) PrepareRename(*testing.T, span.Span, *source.PrepareItem) Symbols(*testing.T, span.URI, []protocol.DocumentSymbol) WorkspaceSymbols(*testing.T, span.URI, string, WorkspaceSymbolsTestType) SignatureHelp(*testing.T, span.Span, *protocol.SignatureHelp) Link(*testing.T, span.URI, []Link) }
type UnimportedCompletions map[span.Span][]Completion
type WorkspaceSymbols map[WorkspaceSymbolsTestType]map[span.URI][]string
Package tests imports 27 packages (graph) and is imported by 2 packages. Updated 2021-01-21. Refresh now. Tools for package owners.