Documentation ¶
Overview ¶
Package tests exports functionality to be used across a variety of gopls tests.
Index ¶
- Constants
- Variables
- func CheckCompletionOrder(want, got []protocol.CompletionItem, strictScores bool) string
- func Context(t testing.TB) context.Context
- func DefaultOptions() source.Options
- func DiffCompletionItems(want, got []protocol.CompletionItem) string
- func DiffDiagnostics(uri span.URI, want, got []source.Diagnostic) string
- func DiffLinks(mapper *protocol.ColumnMapper, wantLinks []Link, ...) string
- func DiffSnippets(want string, got *protocol.CompletionItem) string
- func FilterBuiltins(items []protocol.CompletionItem) []protocol.CompletionItem
- func FindItem(list []protocol.CompletionItem, want source.CompletionItem) *protocol.CompletionItem
- func Run(t *testing.T, tests Tests, data *Data)
- func ToProtocolCompletionItem(item source.CompletionItem) protocol.CompletionItem
- func ToProtocolCompletionItems(items []source.CompletionItem) []protocol.CompletionItem
- type CaseSensitiveCompletions
- type Completion
- type CompletionItems
- type CompletionSnippet
- type CompletionSnippets
- type CompletionTestType
- type Completions
- type Data
- type DeepCompletions
- type Definition
- type Definitions
- type Diagnostics
- type FoldingRanges
- type Formats
- type FuzzyCompletions
- type Golden
- type Highlights
- type Implementations
- type Imports
- type Link
- type Links
- type PrepareRenames
- type RankCompletions
- type References
- type Renames
- type Signatures
- type SuggestedFixes
- type Symbols
- type SymbolsChildren
- type Tests
- type UnimportedCompletions
Constants ¶
View Source
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 CompletionCaseSensitve // CompletionRank candidates in test must be valid and in the right relative order. CompletionRank )
Variables ¶
View Source
var UpdateGolden = flag.Bool("golden", false, "Update golden files")
Functions ¶
func CheckCompletionOrder ¶
func CheckCompletionOrder(want, got []protocol.CompletionItem, strictScores bool) string
func DefaultOptions ¶
func DiffCompletionItems ¶
func DiffCompletionItems(want, got []protocol.CompletionItem) string
DiffCompletionItems prints the diff between expected and actual completion test results.
func DiffDiagnostics ¶
func DiffDiagnostics(uri span.URI, want, got []source.Diagnostic) string
DiffDiagnostics prints the diff between expected and actual diagnostics test results.
func DiffLinks ¶
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 ¶
func DiffSnippets(want string, got *protocol.CompletionItem) string
func FilterBuiltins ¶
func FilterBuiltins(items []protocol.CompletionItem) []protocol.CompletionItem
func FindItem ¶
func FindItem(list []protocol.CompletionItem, want source.CompletionItem) *protocol.CompletionItem
func ToProtocolCompletionItem ¶
func ToProtocolCompletionItem(item source.CompletionItem) protocol.CompletionItem
func ToProtocolCompletionItems ¶
func ToProtocolCompletionItems(items []source.CompletionItem) []protocol.CompletionItem
Types ¶
type CaseSensitiveCompletions ¶
type CaseSensitiveCompletions map[span.Span][]Completion
type Completion ¶
type CompletionItems ¶
type CompletionItems map[token.Pos]*source.CompletionItem
type CompletionSnippet ¶
type CompletionSnippets ¶
type CompletionSnippets map[span.Span][]CompletionSnippet
type CompletionTestType ¶
type CompletionTestType int
type Completions ¶
type Completions map[span.Span][]Completion
type Data ¶
type Data struct { Config packages.Config Exported *packagestest.Exported Diagnostics Diagnostics CompletionItems CompletionItems Completions Completions CompletionSnippets CompletionSnippets UnimportedCompletions UnimportedCompletions DeepCompletions DeepCompletions FuzzyCompletions FuzzyCompletions CaseSensitiveCompletions CaseSensitiveCompletions RankCompletions RankCompletions FoldingRanges FoldingRanges Formats Formats Imports Imports SuggestedFixes SuggestedFixes Definitions Definitions Implementations Implementations Highlights Highlights References References Renames Renames PrepareRenames PrepareRenames Symbols Symbols Signatures Signatures Links Links // contains filtered or unexported fields }
type DeepCompletions ¶
type DeepCompletions map[span.Span][]Completion
type Definition ¶
type Definitions ¶
type Definitions map[span.Span]Definition
type Diagnostics ¶
type Diagnostics map[span.URI][]source.Diagnostic
type FoldingRanges ¶
type FuzzyCompletions ¶
type FuzzyCompletions map[span.Span][]Completion
type PrepareRenames ¶
type PrepareRenames map[span.Span]*source.PrepareItem
type RankCompletions ¶
type RankCompletions map[span.Span][]Completion
type Signatures ¶
type Signatures map[span.Span]*source.SignatureInformation
type SuggestedFixes ¶
type SymbolsChildren ¶
type SymbolsChildren map[string][]protocol.DocumentSymbol
type Tests ¶
type Tests interface { 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) SuggestedFix(*testing.T, 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) SignatureHelp(*testing.T, span.Span, *source.SignatureInformation) Link(*testing.T, span.URI, []Link) }
type UnimportedCompletions ¶
type UnimportedCompletions map[span.Span][]Completion
Click to show internal directories.
Click to hide internal directories.