testutil

package
v0.9.0 Latest Latest
Warning

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

Go to latest
Published: Jul 27, 2026 License: MIT Imports: 10 Imported by: 0

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

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

func ReadRawHooks(t *testing.T, tempDir, settingsDir string) map[string]json.RawMessage

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.

Jump to

Keyboard shortcuts

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