Documentation
¶
Overview ¶
Package effecttest provides test utilities for Effect diagnostic tests.
Index ¶
- Constants
- func AcquireProgram()
- func BaselineLocalPath(subfolder string) string
- func BaselineReferencePath(subfolder string) string
- func DiscoverDocumentSymbolTestCases(version bundledeffect.EffectVersion) ([]string, error)
- func DiscoverRefactorTestCases(version bundledeffect.EffectVersion) ([]string, error)
- func DiscoverTestCases(version bundledeffect.EffectVersion) ([]string, error)
- func DoDocumentSymbolsBaseline(t *testing.T, baselineName string, subfolder string, ...)
- func DoEffectErrorBaseline(t *testing.T, baselineName string, allFiles []*harnessutil.TestFile, ...)
- func DoExecutionFlowBaseline(t *testing.T, baselineName string, c *checker.Checker, ...)
- func DoLayerGraphBaseline(t *testing.T, baselineName string, c *checker.Checker, ...)
- func DoPipingFlowBaseline(t *testing.T, baselineName string, c *checker.Checker, ...)
- func DoQuickFixBaseline(t *testing.T, baselineName string, subfolder string, ...)
- func DoRefactorBaseline(t *testing.T, baselineName string, subfolder string, ...)
- func DocumentSymbolTestCasesDir(version bundledeffect.EffectVersion) string
- func RefactorTestCasesDir(version bundledeffect.EffectVersion) string
- func ReleaseProgram()
- func RunEffectDocumentSymbolsTest(t *testing.T, version bundledeffect.EffectVersion, testFile string)
- func RunEffectQuickFixTest(t *testing.T, version bundledeffect.EffectVersion, testFile string)
- func RunEffectRefactorTest(t *testing.T, version bundledeffect.EffectVersion, testFile string)
- func RunEffectTest(t *testing.T, version bundledeffect.EffectVersion, testFile string)
- func TestCasesDir(version bundledeffect.EffectVersion) string
- func TestDataPath() string
- type DocumentSymbolsFileResult
- type QuickFixApplicationResult
- type QuickFixInventoryEntry
- type RefactorApplicationResult
- type RefactorInventoryEntry
Constants ¶
const DefaultTsConfig = `` /* 203-byte string literal not displayed */
DefaultTsConfig is the default tsconfig content injected when a test does not provide one. It enables the Effect language service plugin with default diagnostic severities.
Variables ¶
This section is empty.
Functions ¶
func AcquireProgram ¶
func AcquireProgram()
AcquireProgram acquires a slot from the program semaphore.
func BaselineLocalPath ¶
BaselineLocalPath returns the path to write local baselines.
func BaselineReferencePath ¶
BaselineReferencePath returns the path to reference baselines.
func DiscoverDocumentSymbolTestCases ¶
func DiscoverDocumentSymbolTestCases(version bundledeffect.EffectVersion) ([]string, error)
DiscoverDocumentSymbolTestCases finds all .ts test files in the document-symbol test cases directory.
func DiscoverRefactorTestCases ¶
func DiscoverRefactorTestCases(version bundledeffect.EffectVersion) ([]string, error)
DiscoverRefactorTestCases finds all .ts test files in the refactor test cases directory.
func DiscoverTestCases ¶
func DiscoverTestCases(version bundledeffect.EffectVersion) ([]string, error)
DiscoverTestCases finds all .ts test files in the test cases directory for the given version.
func DoDocumentSymbolsBaseline ¶
func DoDocumentSymbolsBaseline( t *testing.T, baselineName string, subfolder string, fileSymbols []DocumentSymbolsFileResult, )
DoDocumentSymbolsBaseline generates a .symbols.txt baseline for Effect tests.
func DoEffectErrorBaseline ¶
func DoEffectErrorBaseline( t *testing.T, baselineName string, allFiles []*harnessutil.TestFile, diagnostics []*ast.Diagnostic, _ bool, subfolder string, effectVersion string, )
DoEffectErrorBaseline generates an error baseline for Effect tests. This writes to our testdata directory instead of typescript-go's.
func DoExecutionFlowBaseline ¶
func DoExecutionFlowBaseline( t *testing.T, baselineName string, c *checker.Checker, inputFiles []*harnessutil.TestFile, sourceFileGetter func(string) *ast.SourceFile, subfolder string, )
DoExecutionFlowBaseline generates a .flows.txt index baseline and per-source Mermaid baselines for Effect tests.
func DoLayerGraphBaseline ¶
func DoLayerGraphBaseline( t *testing.T, baselineName string, c *checker.Checker, inputFiles []*harnessutil.TestFile, sourceFileGetter func(string) *ast.SourceFile, subfolder string, )
DoLayerGraphBaseline generates a .layers.txt baseline for Effect tests.
func DoPipingFlowBaseline ¶
func DoPipingFlowBaseline( t *testing.T, baselineName string, c *checker.Checker, inputFiles []*harnessutil.TestFile, sourceFileGetter func(string) *ast.SourceFile, subfolder string, )
DoPipingFlowBaseline generates a .pipings.txt baseline for Effect tests.
func DoQuickFixBaseline ¶
func DoQuickFixBaseline( t *testing.T, baselineName string, subfolder string, inventory []QuickFixInventoryEntry, results []QuickFixApplicationResult, )
DoQuickFixBaseline generates a .quickfixes.txt baseline for Effect tests.
func DoRefactorBaseline ¶
func DoRefactorBaseline( t *testing.T, baselineName string, subfolder string, inventory []RefactorInventoryEntry, results []RefactorApplicationResult, )
DoRefactorBaseline generates a .refactors.txt baseline for Effect refactor tests.
func DocumentSymbolTestCasesDir ¶
func DocumentSymbolTestCasesDir(version bundledeffect.EffectVersion) string
DocumentSymbolTestCasesDir returns the path to the Effect document-symbol test cases directory.
func RefactorTestCasesDir ¶
func RefactorTestCasesDir(version bundledeffect.EffectVersion) string
RefactorTestCasesDir returns the path to the Effect refactor test cases directory.
func ReleaseProgram ¶
func ReleaseProgram()
ReleaseProgram releases a slot back to the program semaphore, clears per-program caches to allow GC of the program, and triggers GC.
func RunEffectDocumentSymbolsTest ¶
func RunEffectDocumentSymbolsTest(t *testing.T, version bundledeffect.EffectVersion, testFile string)
RunEffectDocumentSymbolsTest executes one document-symbol baseline test case.
func RunEffectQuickFixTest ¶
func RunEffectQuickFixTest(t *testing.T, version bundledeffect.EffectVersion, testFile string)
RunEffectQuickFixTest executes a single Effect quick-fix baseline test case. It creates a fourslash test instance, collects quick-fix inventory and application results, and generates a *.quickfixes.txt baseline.
func RunEffectRefactorTest ¶
func RunEffectRefactorTest(t *testing.T, version bundledeffect.EffectVersion, testFile string)
RunEffectRefactorTest executes a single Effect refactor baseline test case. It creates a fourslash test instance, collects refactor inventory and application results for the selection specified by a "// refactor:" comment, and generates a *.refactors.txt baseline.
func RunEffectTest ¶
func RunEffectTest(t *testing.T, version bundledeffect.EffectVersion, testFile string)
RunEffectTest executes a single Effect diagnostic test case for the given version.
func TestCasesDir ¶
func TestCasesDir(version bundledeffect.EffectVersion) string
TestCasesDir returns the path to the Effect test cases directory for the given version.
func TestDataPath ¶
func TestDataPath() string
TestDataPath returns the path to our testdata directory.
Types ¶
type DocumentSymbolsFileResult ¶
type DocumentSymbolsFileResult struct {
FileName string
DocumentTrees [][]*lsproto.DocumentSymbol
FlatLists [][]*lsproto.SymbolInformation
}
DocumentSymbolsFileResult stores document-symbol results for one file.
type QuickFixApplicationResult ¶
type QuickFixApplicationResult struct {
// DiagnosticID is the stable diagnostic identifier (e.g., "D1").
DiagnosticID string
// FixIndex is the index of the quick fix that was applied.
FixIndex int
// FixTitle is the title of the quick fix that was applied.
FixTitle string
// Changes is the list of file changes from applying the quick fix.
Changes []fourslash.FileChange
// Skipped indicates the fix was intentionally not applied (e.g., disable-style fixes).
Skipped bool
}
QuickFixApplicationResult represents the result of applying one quick fix.
type QuickFixInventoryEntry ¶
type QuickFixInventoryEntry struct {
// ID is the stable diagnostic identifier (e.g., "D1", "D2").
ID string
// FileURI is the document URI of the file containing the diagnostic.
FileURI lsproto.DocumentUri
// Diagnostic is the LSP diagnostic.
Diagnostic *lsproto.Diagnostic
// FixTitles is the list of available quick-fix titles.
FixTitles []string
}
QuickFixInventoryEntry represents one diagnostic occurrence with its available quick fixes.
type RefactorApplicationResult ¶
type RefactorApplicationResult struct {
// RangeID is the stable range identifier (e.g., "R1").
RangeID string
// ActionIndex is the index of the refactor action that was applied.
ActionIndex int
// ActionTitle is the title of the refactor action that was applied.
ActionTitle string
// Changes is the list of file changes from applying the refactor.
Changes []fourslash.FileChange
}
RefactorApplicationResult represents the result of applying one refactor action.
type RefactorInventoryEntry ¶
type RefactorInventoryEntry struct {
// ID is the stable range identifier (e.g., "R1", "R2").
ID string
// RangeText is a short excerpt of the selected text.
RangeText string
// ActionTitles is the list of available refactor action titles.
ActionTitles []string
// ActionKinds is the list of code action kinds parallel to ActionTitles.
ActionKinds []string
}
RefactorInventoryEntry represents one selection range with its available refactor actions.