Documentation
¶
Overview ¶
Package testutil provides shared test utilities for agent packages.
Package testutil holds shared test helpers for the agent package and its sub-packages. Not for production use.
Index ¶
- func FakeStreamCmd(stdout, stderr string, exitCode int) func(ctx context.Context, name string, args ...string) *exec.Cmd
- func FakeStreamCmdHang(stdout, stderr string) func(ctx context.Context, name string, args ...string) *exec.Cmd
- func GetKeys(m map[string]json.RawMessage) []string
- func ReadRawHooks(t *testing.T, tempDir, settingsDir string) map[string]json.RawMessage
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func FakeStreamCmd ¶ added in v0.9.0
func FakeStreamCmd(stdout, stderr string, exitCode int) func(ctx context.Context, name string, args ...string) *exec.Cmd
FakeStreamCmd returns a CommandRunner factory whose *exec.Cmd, when Start()'d and Wait()'d, produces stdout/stderr/exit-code as configured. It relaunches the current Go test binary and is portable across supported platforms; package init handles the marked child before testing.Main runs.
func FakeStreamCmdHang ¶ added in v0.9.0
func FakeStreamCmdHang(stdout, stderr string) func(ctx context.Context, name string, args ...string) *exec.Cmd
FakeStreamCmdHang is FakeStreamCmd whose child writes the fixtures and then blocks until killed — it never exits on its own. Wire it to the real test ctx (do not detach) to deterministically exercise context-kill behavior: cancel the ctx and the child dies by signal with the fixtures already written to the pipe.
func GetKeys ¶
func GetKeys(m map[string]json.RawMessage) []string
GetKeys returns the keys of a map as a slice.
func ReadRawHooks ¶
ReadRawHooks reads the raw hooks map from a settings file. settingsDir is the directory name (e.g., ".claude" or ".gemini").
Types ¶
This section is empty.