builders

package
v0.4.0 Latest Latest
Warning

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

Go to latest
Published: Feb 7, 2026 License: MIT Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ExpectedResult

type ExpectedResult struct {
	Path       string
	Line       int
	Contains   string
	MinScore   float64
	NotPresent bool // If true, this path should NOT be in results
}

ExpectedResult represents an expected search result

type FileContentBuilder

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

FileContentBuilder helps build complex file contents for testing

func NewFileContentBuilder

func NewFileContentBuilder() *FileContentBuilder

NewFileContentBuilder creates a new file content builder

func (*FileContentBuilder) Blank

Blank adds a blank line

func (*FileContentBuilder) Build

func (b *FileContentBuilder) Build() string

Build returns the final content string

func (*FileContentBuilder) Comment

func (b *FileContentBuilder) Comment(text string) *FileContentBuilder

Comment adds a comment

func (*FileContentBuilder) Function

func (b *FileContentBuilder) Function(name string, params string, body string) *FileContentBuilder

Function adds a function definition

func (*FileContentBuilder) Import

Import adds an import statement

func (*FileContentBuilder) Imports

func (b *FileContentBuilder) Imports(pkgs ...string) *FileContentBuilder

Imports adds multiple imports

func (*FileContentBuilder) Line

Line adds a raw line

func (*FileContentBuilder) Method

func (b *FileContentBuilder) Method(receiver, receiverType, name, params, body string) *FileContentBuilder

Method adds a method definition

func (*FileContentBuilder) Package

func (b *FileContentBuilder) Package(name string) *FileContentBuilder

Package adds a package declaration (for Go files)

func (*FileContentBuilder) Struct

func (b *FileContentBuilder) Struct(name string, fields map[string]string) *FileContentBuilder

Struct adds a struct definition

type MockResultBuilder

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

MockResultBuilder helps build mock search results for testing

func NewMockResultBuilder

func NewMockResultBuilder() *MockResultBuilder

NewMockResultBuilder creates a new mock result builder

func (*MockResultBuilder) AddResult

func (b *MockResultBuilder) AddResult(path string, line int, match string, score float64) *MockResultBuilder

AddResult adds a mock result

func (*MockResultBuilder) Build

Build returns the mock results

type ProjectBuilder

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

ProjectBuilder helps build test project structures

func NewProjectBuilder

func NewProjectBuilder(t *testing.T) *ProjectBuilder

NewProjectBuilder creates a new project builder

func (*ProjectBuilder) AddFile

func (p *ProjectBuilder) AddFile(path, content string) *ProjectBuilder

AddFile adds a file to the project

func (*ProjectBuilder) AddGoModule

func (p *ProjectBuilder) AddGoModule(moduleName string) *ProjectBuilder

AddGoModule adds a Go module with main.go and go.mod

func (*ProjectBuilder) AddGoPackage

func (p *ProjectBuilder) AddGoPackage(pkgPath string, files map[string]string) *ProjectBuilder

AddGoPackage adds a Go package with the given files

func (*ProjectBuilder) AddJSProject

func (p *ProjectBuilder) AddJSProject() *ProjectBuilder

AddJSProject adds a basic JavaScript project

func (*ProjectBuilder) AddPythonProject

func (p *ProjectBuilder) AddPythonProject() *ProjectBuilder

AddPythonProject adds a basic Python project

func (*ProjectBuilder) Build

func (p *ProjectBuilder) Build() *TestIndexer

Build writes all files and returns the indexer

func (*ProjectBuilder) TempDir

func (p *ProjectBuilder) TempDir() string

TempDir returns the temporary directory path

type SearchTestBuilder

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

SearchTestBuilder provides fluent API for building search test scenarios

func NewSearchTestBuilder

func NewSearchTestBuilder(t *testing.T) *SearchTestBuilder

NewSearchTestBuilder creates a new search test builder

func (*SearchTestBuilder) Build

func (b *SearchTestBuilder) Build() *TestIndexer

Build creates the test scenario and returns the indexer

func (*SearchTestBuilder) CaseInsensitive

func (b *SearchTestBuilder) CaseInsensitive() *SearchTestBuilder

CaseInsensitive enables case-insensitive search

func (*SearchTestBuilder) ExpectNotFound

func (b *SearchTestBuilder) ExpectNotFound(path string) *SearchTestBuilder

ExpectNotFound marks a path that should NOT appear in results

func (*SearchTestBuilder) ExpectPath

func (b *SearchTestBuilder) ExpectPath(path string) *SearchTestBuilder

ExpectPath adds an expected result path

func (*SearchTestBuilder) ExpectResult

func (b *SearchTestBuilder) ExpectResult(path string, line int, contains string) *SearchTestBuilder

ExpectResult adds an expected result with details

func (*SearchTestBuilder) FilesOnly

func (b *SearchTestBuilder) FilesOnly() *SearchTestBuilder

FilesOnly enables files-only mode

func (*SearchTestBuilder) Run

Run executes the search and validates expectations

func (*SearchTestBuilder) SearchFor

func (b *SearchTestBuilder) SearchFor(pattern string) *SearchTestBuilder

SearchFor sets the search pattern

func (*SearchTestBuilder) WithFile

func (b *SearchTestBuilder) WithFile(path, content string) *SearchTestBuilder

WithFile adds a file to be indexed

func (*SearchTestBuilder) WithGoFile

func (b *SearchTestBuilder) WithGoFile(pkg string, funcs ...string) *SearchTestBuilder

WithGoFile adds a Go file with the given package name and functions

func (*SearchTestBuilder) WithJSFile

func (b *SearchTestBuilder) WithJSFile(name string, functions ...string) *SearchTestBuilder

WithJSFile adds a JavaScript file

func (*SearchTestBuilder) WithMaxResults

func (b *SearchTestBuilder) WithMaxResults(max int) *SearchTestBuilder

WithMaxResults sets the maximum number of results

func (*SearchTestBuilder) WithPythonFile

func (b *SearchTestBuilder) WithPythonFile(name string, functions ...string) *SearchTestBuilder

WithPythonFile adds a Python file

func (*SearchTestBuilder) WithRegex

func (b *SearchTestBuilder) WithRegex() *SearchTestBuilder

WithRegex enables regex search

func (*SearchTestBuilder) WithWordBoundary

func (b *SearchTestBuilder) WithWordBoundary() *SearchTestBuilder

WithWordBoundary enables word boundary matching

type SearchTestResult

type SearchTestResult struct {
	Pattern      string
	Results      []searchtypes.GrepResult
	FileCount    int
	Expectations []ExpectedResult
}

SearchTestResult holds the results of a search test

type SymbolBuilder

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

SymbolBuilder helps build test symbols

func NewSymbolBuilder

func NewSymbolBuilder() *SymbolBuilder

NewSymbolBuilder creates a new symbol builder

func (*SymbolBuilder) AddClass

func (b *SymbolBuilder) AddClass(name string, line, col int) *SymbolBuilder

AddClass adds a class/struct symbol

func (*SymbolBuilder) AddFunction

func (b *SymbolBuilder) AddFunction(name string, line, col int) *SymbolBuilder

AddFunction adds a function symbol

func (*SymbolBuilder) AddMethod

func (b *SymbolBuilder) AddMethod(name string, line, col int) *SymbolBuilder

AddMethod adds a method symbol

func (*SymbolBuilder) AddVariable

func (b *SymbolBuilder) AddVariable(name string, line, col int) *SymbolBuilder

AddVariable adds a variable symbol

func (*SymbolBuilder) Build

func (b *SymbolBuilder) Build() []*types.EnhancedSymbol

Build returns the built symbols

type TestFile

type TestFile struct {
	Path    string
	Content string
}

TestFile represents a file for testing

type TestIndexer

type TestIndexer struct {
	*indexing.MasterIndex
	// contains filtered or unexported fields
}

TestIndexer provides a real indexer configured for testing

func NewTestIndexer

func NewTestIndexer(t *testing.T) *TestIndexer

NewTestIndexer creates a new indexer optimized for testing

func (*TestIndexer) AssertSymbolExists

func (ti *TestIndexer) AssertSymbolExists(t *testing.T, name string, symbolType types.SymbolType)

AssertSymbolExists verifies a symbol exists with the given properties

func (*TestIndexer) Close

func (ti *TestIndexer) Close() error

Close cleans up the indexer and stops background goroutines

func (*TestIndexer) GetFileCount

func (ti *TestIndexer) GetFileCount() int

GetFileCount returns the number of indexed files

func (*TestIndexer) GetFileReferences

func (ti *TestIndexer) GetFileReferences(fileID types.FileID) []types.Reference

GetFileReferences returns references for a file

func (*TestIndexer) GetFileSymbols

func (ti *TestIndexer) GetFileSymbols(fileID types.FileID) []types.Symbol

GetFileSymbols returns symbols for a file

func (*TestIndexer) GetSymbolCount

func (ti *TestIndexer) GetSymbolCount() int

GetSymbolCount returns the total number of symbols

func (*TestIndexer) GetSymbolsByName

func (ti *TestIndexer) GetSymbolsByName(name string) []*types.EnhancedSymbol

GetSymbolsByName finds symbols by name

func (*TestIndexer) IndexFiles

func (ti *TestIndexer) IndexFiles(files map[string]string) error

IndexFiles indexes multiple files at once

func (*TestIndexer) IndexString

func (ti *TestIndexer) IndexString(filename, content string) error

IndexString indexes a string as if it were a file

Jump to

Keyboard shortcuts

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