testutil

package
v0.1.1 Latest Latest
Warning

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

Go to latest
Published: Jan 20, 2026 License: MIT Imports: 15 Imported by: 0

Documentation

Overview

Package testutil provides test utilities for subtask e2e tests.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AssertGolden

func AssertGolden(t *testing.T, relPath string, got string)

AssertGolden compares got to the contents of relPath. If -update (or SUBTASK_UPDATE_GOLDEN) is set, it rewrites the golden file.

relPath is resolved relative to the calling test file's directory (so it works even if the test changes the process cwd).

func AssertGoldenOutput

func AssertGoldenOutput(t *testing.T, relBasePath string, got string)

AssertGoldenOutput compares got to a golden file based on the current output mode. In pretty mode it uses a `.ansi` file, otherwise it uses a `.txt` file.

relBasePath is resolved relative to the calling test file's directory.

func IsClean

func IsClean(t *testing.T, dir string) bool

IsClean checks if a directory has no uncommitted changes.

Types

type TestEnv

type TestEnv struct {
	T          *testing.T
	RootDir    string   // Temp directory simulating project root
	Workspaces []string // Paths to workspace directories
	// contains filtered or unexported fields
}

TestEnv encapsulates an isolated test environment.

func NewTestEnv

func NewTestEnv(t *testing.T, numWorkspaces int) *TestEnv

NewTestEnv creates an isolated test environment with git repos.

func (*TestEnv) Config

func (e *TestEnv) Config() *workspace.Config

Config returns the loaded workspace config.

func (*TestEnv) CreateTask

func (e *TestEnv) CreateTask(name, title, base, description string) *task.Task

CreateTask creates a task with TASK.md.

func (*TestEnv) CreateTaskHistory

func (e *TestEnv) CreateTaskHistory(name string, events []history.Event)

CreateTaskHistory creates (or replaces) history.jsonl for a task.

func (*TestEnv) CreateTaskProgress

func (e *TestEnv) CreateTaskProgress(name string, progress *task.Progress)

CreateTaskProgress creates a progress.json for a task.

func (*TestEnv) CreateTaskState

func (e *TestEnv) CreateTaskState(name string, state *task.State)

CreateTaskState creates a state.json for a task.

func (*TestEnv) MakeDirty

func (e *TestEnv) MakeDirty(workspaceIdx int)

MakeDirty creates uncommitted changes in a workspace.

Jump to

Keyboard shortcuts

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