Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Expectation ¶
type Expectation struct {
Kind string // "file_exists", "no_file", "node_count", "error", "equal"
Path string // for file expectations
Content string // optional expected content
Count int // for node_count
Pattern string // for error expectations
Got starlark.Value // for equal expectations
Want starlark.Value // for equal expectations
}
Expectation represents a single test assertion queued during script execution.
type Option ¶
type Option func(*Runner)
Option configures a Runner.
func WithDryRun ¶
func WithDryRun() Option
WithDryRun enables dry-run mode (plan only, no side effects).
func WithProvider ¶
WithProvider restricts execution to a specific provider.
func WithReceivers ¶
WithReceivers sets the Starlark namespaces to expose as globals.
func WithWriter ¶
WithWriter sets the output writer for executor messages.
type Result ¶
type Result struct {
Passed bool `json:"passed"`
NodeCount int `json:"node_count"`
ExpectationCount int `json:"expectation_count"`
Failures []Failure `json:"failures"`
Trace []string `json:"trace,omitempty"`
}
Result is the structured output of a test run.
type Runner ¶
type Runner struct {
// contains filtered or unexported fields
}
Runner orchestrates a single test script execution.
type TestContext ¶
type TestContext struct {
// contains filtered or unexported fields
}
TestContext is the `t` namespace injected into Starlark test scripts. It provides a temp directory and queues expectations that are checked after graph execution completes. File checks are scoped through op.Root when available.
func NewTestContext ¶
func NewTestContext(tmpDir string, root op.Root) *TestContext
NewTestContext creates a TestContext rooted at the given temp directory. When root is non-nil, file checks (checkFileExists, checkNoFile) are scoped through op.Root.
func (*TestContext) Check ¶
func (tc *TestContext) Check(graph *op.Graph, execErr error) []Failure
Check evaluates all queued expectations against the executed graph and filesystem. Returns failures for any expectations that did not hold.
func (*TestContext) Expectations ¶
func (tc *TestContext) Expectations() []Expectation
Expectations returns the queued expectations.
func (*TestContext) StarlarkValue ¶
func (tc *TestContext) StarlarkValue() starlark.Value
StarlarkValue returns the `t` namespace as a Starlark struct.
func (*TestContext) TmpDir ¶
func (tc *TestContext) TmpDir() string
TmpDir returns the temp directory path.
type Tracer ¶
type Tracer struct {
// contains filtered or unexported fields
}
Tracer collects trace entries during Starlark script execution. When enabled, it records position and expression info via the thread's Print handler and captures plan.* invocations.
func (*Tracer) PrintHandler ¶
PrintHandler returns a starlark.Thread.Print function that captures print() output as trace entries and logs them.