support

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Jun 6, 2026 License: MIT Imports: 14 Imported by: 0

Documentation

Overview

Package support contains the BDD world / step definitions for agentsync.

Hermeticity contract:

  • Every Scenario runs against a fresh tmpdir.
  • HOME and AGENTSYNC_TARGET_ROOT both point at that tmpdir.
  • No real $HOME path is ever read or written.
  • The agentsync binary is the System Under Test; the suite shells out to it instead of importing internal packages, so we exercise the same entrypoint the engineer ships.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func BuildBinary

func BuildBinary(t *testing.T) string

BuildBinary compiles the agentsync binary once per test process and returns its absolute path. The binary lives in a stable temp dir so subsequent scenarios don't pay the build cost.

func RegisterSteps

func RegisterSteps(sc *godog.ScenarioContext, w *World)

RegisterSteps wires every Gherkin phrase used by the .feature files to a concrete Go implementation.

Types

type World

type World struct {
	Bin       string
	Home      string
	WorkDir   string
	ExtraEnv  map[string]string
	LastOut   string
	LastErr   error
	LastCode  int
	StartedAt time.Time
	// contains filtered or unexported fields
}

World is the per-scenario state.

func (*World) AppendFile

func (w *World) AppendFile(rel, content string) error

AppendFile appends content to a path inside Home.

func (*World) Cleanup

func (w *World) Cleanup()

Cleanup removes the scenario tmpdir.

func (*World) Env

func (w *World) Env() []string

Env returns the env slice passed to every binary invocation. It does NOT inherit the host $HOME or XDG vars; AGENTSYNC_TARGET_ROOT is the redirect guarantee documented in the design spec.

func (*World) MustRun

func (w *World) MustRun(args ...string) string

MustRun runs and fatals the scenario on error.

func (*World) ReadFile

func (w *World) ReadFile(rel string) (string, error)

ReadFile reads a path inside Home.

func (*World) Reset

func (w *World) Reset(t *testing.T, bin string) error

Reset wipes per-scenario state and provisions a fresh hermetic root.

func (*World) Resolve

func (w *World) Resolve(rel string) string

Resolve turns a path into an absolute path under Home if it is not already absolute. This keeps every scenario rooted in its tmpdir without surprises.

func (*World) Run

func (w *World) Run(args ...string) (string, error)

Run invokes the binary with args; output is captured combined.

func (*World) WriteFile

func (w *World) WriteFile(rel, content string) error

WriteFile writes content to a path inside the hermetic Home, creating parent directories. The path is treated as relative to Home unless absolute.

Jump to

Keyboard shortcuts

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