Documentation
¶
Index ¶
- type ExpectedResult
- type FileContentBuilder
- func (b *FileContentBuilder) Blank() *FileContentBuilder
- func (b *FileContentBuilder) Build() string
- func (b *FileContentBuilder) Comment(text string) *FileContentBuilder
- func (b *FileContentBuilder) Function(name string, params string, body string) *FileContentBuilder
- func (b *FileContentBuilder) Import(pkg string) *FileContentBuilder
- func (b *FileContentBuilder) Imports(pkgs ...string) *FileContentBuilder
- func (b *FileContentBuilder) Line(text string) *FileContentBuilder
- func (b *FileContentBuilder) Method(receiver, receiverType, name, params, body string) *FileContentBuilder
- func (b *FileContentBuilder) Package(name string) *FileContentBuilder
- func (b *FileContentBuilder) Struct(name string, fields map[string]string) *FileContentBuilder
- type MockResultBuilder
- type ProjectBuilder
- func (p *ProjectBuilder) AddFile(path, content string) *ProjectBuilder
- func (p *ProjectBuilder) AddGoModule(moduleName string) *ProjectBuilder
- func (p *ProjectBuilder) AddGoPackage(pkgPath string, files map[string]string) *ProjectBuilder
- func (p *ProjectBuilder) AddJSProject() *ProjectBuilder
- func (p *ProjectBuilder) AddPythonProject() *ProjectBuilder
- func (p *ProjectBuilder) Build() *TestIndexer
- func (p *ProjectBuilder) TempDir() string
- type SearchTestBuilder
- func (b *SearchTestBuilder) Build() *TestIndexer
- func (b *SearchTestBuilder) CaseInsensitive() *SearchTestBuilder
- func (b *SearchTestBuilder) ExpectNotFound(path string) *SearchTestBuilder
- func (b *SearchTestBuilder) ExpectPath(path string) *SearchTestBuilder
- func (b *SearchTestBuilder) ExpectResult(path string, line int, contains string) *SearchTestBuilder
- func (b *SearchTestBuilder) FilesOnly() *SearchTestBuilder
- func (b *SearchTestBuilder) Run() SearchTestResult
- func (b *SearchTestBuilder) SearchFor(pattern string) *SearchTestBuilder
- func (b *SearchTestBuilder) WithFile(path, content string) *SearchTestBuilder
- func (b *SearchTestBuilder) WithGoFile(pkg string, funcs ...string) *SearchTestBuilder
- func (b *SearchTestBuilder) WithJSFile(name string, functions ...string) *SearchTestBuilder
- func (b *SearchTestBuilder) WithMaxResults(max int) *SearchTestBuilder
- func (b *SearchTestBuilder) WithPythonFile(name string, functions ...string) *SearchTestBuilder
- func (b *SearchTestBuilder) WithRegex() *SearchTestBuilder
- func (b *SearchTestBuilder) WithWordBoundary() *SearchTestBuilder
- type SearchTestResult
- type SymbolBuilder
- func (b *SymbolBuilder) AddClass(name string, line, col int) *SymbolBuilder
- func (b *SymbolBuilder) AddFunction(name string, line, col int) *SymbolBuilder
- func (b *SymbolBuilder) AddMethod(name string, line, col int) *SymbolBuilder
- func (b *SymbolBuilder) AddVariable(name string, line, col int) *SymbolBuilder
- func (b *SymbolBuilder) Build() []*types.EnhancedSymbol
- type TestFile
- type TestIndexer
- func (ti *TestIndexer) AssertSymbolExists(t *testing.T, name string, symbolType types.SymbolType)
- func (ti *TestIndexer) Close() error
- func (ti *TestIndexer) GetFileCount() int
- func (ti *TestIndexer) GetFileReferences(fileID types.FileID) []types.Reference
- func (ti *TestIndexer) GetFileSymbols(fileID types.FileID) []types.Symbol
- func (ti *TestIndexer) GetSymbolCount() int
- func (ti *TestIndexer) GetSymbolsByName(name string) []*types.EnhancedSymbol
- func (ti *TestIndexer) IndexFiles(files map[string]string) error
- func (ti *TestIndexer) IndexString(filename, content string) error
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 ¶
func (b *FileContentBuilder) Blank() *FileContentBuilder
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 ¶
func (b *FileContentBuilder) Import(pkg string) *FileContentBuilder
Import adds an import statement
func (*FileContentBuilder) Imports ¶
func (b *FileContentBuilder) Imports(pkgs ...string) *FileContentBuilder
Imports adds multiple imports
func (*FileContentBuilder) Line ¶
func (b *FileContentBuilder) Line(text string) *FileContentBuilder
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 ¶
func (b *MockResultBuilder) Build() []searchtypes.GrepResult
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 ¶
func (b *SearchTestBuilder) Run() SearchTestResult
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 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