adaptertest

package
v0.10.5 Latest Latest
Warning

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

Go to latest
Published: Sep 25, 2026 License: MIT Imports: 4 Imported by: 0

Documentation

Overview

Package adaptertest provides a recording fake of adapter.Backend for tests. It replaces the old fake-tmux-binary harness: instead of grepping a shell log of tmux argv, tests assert directly on the recorded backend calls.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Backend

type Backend struct {

	// Sessions is returned by List.
	Sessions []session.Info
	// CaptureText is returned by Capture.
	CaptureText string

	CreateErr  error
	ListErr    error
	CaptureErr error
	SendErr    error
	KillErr    error
	LabelErr   error
	HasResult  bool
	AttachExe  string
	// contains filtered or unexported fields
}

Backend is an in-memory adapter.Backend that records every call and serves configurable results.

func (*Backend) AttachArgv

func (b *Backend) AttachArgv(name string) ([]string, error)

func (*Backend) Calls

func (b *Backend) Calls() []Call

Calls returns a copy of all recorded calls.

func (*Backend) CallsOf

func (b *Backend) CallsOf(op string) []Call

CallsOf returns the recorded calls with the given op.

func (*Backend) Capture

func (b *Backend) Capture(_ context.Context, name string, lines int) (string, error)

func (*Backend) CommandLog

func (b *Backend) CommandLog() string

CommandLog renders the created sessions' argv as lines, for substring asserts equivalent to the old fake-tmux log greps.

func (*Backend) CreateProviderSession

func (b *Backend) CreateProviderSession(_ context.Context, spec session.CreateSpec) error

func (*Backend) HasSession

func (b *Backend) HasSession(_ context.Context, name string) bool

func (*Backend) Kill

func (b *Backend) Kill(_ context.Context, name string) error

func (*Backend) List

func (b *Backend) List(_ context.Context) ([]session.Info, error)

func (*Backend) SendLine

func (b *Backend) SendLine(_ context.Context, name, text string) error

func (*Backend) SendPrompt

func (b *Backend) SendPrompt(_ context.Context, name, text string) error

SendPrompt records as a "send" call: tests assert on what was typed, not on the readiness wait the real host performs.

func (*Backend) SetSessionLabel

func (b *Backend) SetSessionLabel(_ context.Context, name, label string) error

type Call

type Call struct {
	Op               string
	Name             string
	Cwd              string
	ProviderIdentity string
	ScrollbackLines  int
	Env              map[string]string
	Command          []string
	Text             string
	Lines            int
	Label            string
}

Call is one recorded backend invocation.

Jump to

Keyboard shortcuts

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