indextest

package
v1.5.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 6, 2026 License: Apache-2.0 Imports: 6 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package indextest holds a recording tools.Index double: a test checks that a run builds one code-search index, hands the same instance to its Runner and to specgen's Options, and closes it once on every exit path.

It is imported only from tests.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Next

func Next() int64

Next returns the next sequence number. A test double for a phase calls it to stamp the moment the phase starts.

Types

type Event

type Event struct {
	// Kind is "invalidate" or "close".
	Kind string
	// Rel is the path argument of an invalidate.
	Rel string
	// Seq is the call's place in the process-wide order; see Next.
	Seq int64
}

Event is one recorded call on an Index.

type Index

type Index struct {
	// contains filtered or unexported fields
}

Index is a tools.Index that records Invalidate and Close calls. Its Tools returns a code_search tool with an Execute func, as the real index does.

func (*Index) Close

func (i *Index) Close() error

Close records the call. Like the real index's, it is safe to call twice; CloseCalls is how a test sees that it was.

func (*Index) CloseCalls

func (i *Index) CloseCalls() int

CloseCalls is how many times Close was called.

func (*Index) Events

func (i *Index) Events() []Event

Events returns a copy of the recorded calls, in order.

func (*Index) Invalidate

func (i *Index) Invalidate(rel string)

Invalidate records the call.

func (*Index) InvalidateCalls

func (i *Index) InvalidateCalls() int

InvalidateCalls is how many times Invalidate was called.

func (*Index) Symbols

Symbols never answers: the caller falls back to its own table.

func (*Index) Tools

func (*Index) Tools() []core.Tool

Tools returns a code_search tool.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL