tools: golang.org/x/tools/internal/lsp/tests Index | Files

package tests

import "golang.org/x/tools/internal/lsp/tests"

Index

Package Files

tests.go

Constants

const (
    ExpectedCompletionsCount       = 160
    ExpectedCompletionSnippetCount = 16
    ExpectedDiagnosticsCount       = 21
    ExpectedFormatCount            = 6
    ExpectedImportCount            = 2
    ExpectedSuggestedFixCount      = 1
    ExpectedDefinitionsCount       = 39
    ExpectedTypeDefinitionsCount   = 2
    ExpectedFoldingRangesCount     = 2
    ExpectedHighlightsCount        = 2
    ExpectedReferencesCount        = 6
    ExpectedRenamesCount           = 20
    ExpectedPrepareRenamesCount    = 8
    ExpectedSymbolsCount           = 1
    ExpectedSignaturesCount        = 21
    ExpectedLinksCount             = 4
)

We hardcode the expected number of test cases to ensure that all tests are being executed. If a test is added, this number must be changed.

func Context Uses

func Context(t testing.TB) context.Context

func DiffDiagnostics Uses

func DiffDiagnostics(uri span.URI, want, got []source.Diagnostic) string

diffDiagnostics prints the diff between expected and actual diagnostics test results.

func Run Uses

func Run(t *testing.T, tests Tests, data *Data)

type Completion Uses

type Completion struct {
    CompletionItems []token.Pos
    Type            CompletionTestType
}

type CompletionItems Uses

type CompletionItems map[token.Pos]*source.CompletionItem

type CompletionSnippet Uses

type CompletionSnippet struct {
    CompletionItem     token.Pos
    PlainSnippet       string
    PlaceholderSnippet string
}

type CompletionSnippets Uses

type CompletionSnippets map[span.Span]CompletionSnippet

type CompletionTestType Uses

type CompletionTestType int
const (
    // Full means candidates in test must match full list of candidates.
    CompletionFull CompletionTestType = iota

    // Partial means candidates in test must be valid and in the right relative order.
    CompletionPartial
)

type Completions Uses

type Completions map[span.Span]Completion

type Data Uses

type Data struct {
    Config             packages.Config
    Exported           *packagestest.Exported
    Diagnostics        Diagnostics
    CompletionItems    CompletionItems
    Completions        Completions
    CompletionSnippets CompletionSnippets
    FoldingRanges      FoldingRanges
    Formats            Formats
    Imports            Imports
    SuggestedFixes     SuggestedFixes
    Definitions        Definitions
    Highlights         Highlights
    References         References
    Renames            Renames
    PrepareRenames     PrepareRenames
    Symbols            Symbols

    Signatures Signatures
    Links      Links
    // contains filtered or unexported fields
}

func Load Uses

func Load(t testing.TB, exporter packagestest.Exporter, dir string) *Data

func (*Data) Golden Uses

func (data *Data) Golden(tag string, target string, update func() ([]byte, error)) []byte

type Definition Uses

type Definition struct {
    Name      string
    IsType    bool
    OnlyHover bool
    Src, Def  span.Span
}

type Definitions Uses

type Definitions map[span.Span]Definition

type Diagnostics Uses

type Diagnostics map[span.URI][]source.Diagnostic

type FoldingRanges Uses

type FoldingRanges []span.Span

type Formats Uses

type Formats []span.Span

type Golden Uses

type Golden struct {
    Filename string
    Archive  *txtar.Archive
    Modified bool
}

type Highlights Uses

type Highlights map[string][]span.Span

type Imports Uses

type Imports []span.Span
type Link struct {
    Src          span.Span
    Target       string
    NotePosition token.Position
}
type Links map[span.URI][]Link

type PrepareRenames Uses

type PrepareRenames map[span.Span]*source.PrepareItem

type References Uses

type References map[span.Span][]span.Span

type Renames Uses

type Renames map[span.Span]string

type Signatures Uses

type Signatures map[span.Span]*source.SignatureInformation

type SuggestedFixes Uses

type SuggestedFixes []span.Span

type Symbols Uses

type Symbols map[span.URI][]protocol.DocumentSymbol

type SymbolsChildren Uses

type SymbolsChildren map[string][]protocol.DocumentSymbol

type Tests Uses

type Tests interface {
    Diagnostics(*testing.T, Diagnostics)
    Completion(*testing.T, Completions, CompletionSnippets, CompletionItems)
    FoldingRange(*testing.T, FoldingRanges)
    Format(*testing.T, Formats)
    Import(*testing.T, Imports)
    SuggestedFix(*testing.T, SuggestedFixes)
    Definition(*testing.T, Definitions)
    Highlight(*testing.T, Highlights)
    Reference(*testing.T, References)
    Rename(*testing.T, Renames)
    PrepareRename(*testing.T, PrepareRenames)
    Symbol(*testing.T, Symbols)
    SignatureHelp(*testing.T, Signatures)
    Link(*testing.T, Links)
}

Package tests imports 18 packages (graph). Updated 2019-09-15. Refresh now. Tools for package owners.