Documentation
¶
Index ¶
- type Checker
- type CommandCheckError
- type CommandResult
- type DiffError
- type Handler
- type Interpreter
- type Recorder
- type Updater
- func (upr *Updater) HandleComment(ctx context.Context, text string) error
- func (upr *Updater) HandleEnd(ctx context.Context) error
- func (upr *Updater) HandleExitCode(ctx context.Context, exitCode int) error
- func (upr *Updater) HandleFileOutput(ctx context.Context, fd int, filepath string) error
- func (upr *Updater) HandleNoNewline(ctx context.Context, fd int) error
- func (upr *Updater) HandleOutput(ctx context.Context, fd int, line string) error
- func (upr *Updater) HandleRun(ctx context.Context, command string) error
- func (upr *Updater) UpdateTranscript(ctx context.Context, r io.Reader) (transcript *bytes.Buffer, err error)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Checker ¶
type Checker struct {
// contains filtered or unexported fields
}
func (*Checker) CheckTranscript ¶
type CommandCheckError ¶
func (CommandCheckError) Error ¶
func (err CommandCheckError) Error() string
type CommandResult ¶
type Handler ¶
type Handler interface { // HandleComment processes comment lines and blank lines. // Corresponds to cmdt syntax: "# comment text" or blank lines. HandleComment(ctx context.Context, text string) error // HandleRun executes a shell command. // Corresponds to cmdt syntax: "$ command args". HandleRun(ctx context.Context, command string) error // HandleOutput processes expected output from a command. // The fd parameter indicates the file descriptor: 1 for stdout, 2 for stderr. // Corresponds to cmdt syntax: "1 stdout line" or "2 stderr line". HandleOutput(ctx context.Context, fd int, line string) error // HandleFileOutput processes expected output that references an external file. // The fd parameter indicates the file descriptor: 1 for stdout, 2 for stderr. // The filepath parameter specifies the file containing the expected output. // Corresponds to cmdt syntax: "1< filename" or "2< filename". HandleFileOutput(ctx context.Context, fd int, filepath string) error // HandleNoNewline indicates that the last output line did not end with a newline. // The fd parameter indicates which stream (stdout=1, stderr=2) lacks the newline. // Corresponds to cmdt syntax: "% no-newline". HandleNoNewline(ctx context.Context, fd int) error // HandleExitCode processes the expected exit code of a command. // If omitted in the transcript, the exit code defaults to 0. // Corresponds to cmdt syntax: "? exitcode". HandleExitCode(ctx context.Context, exitCode int) error // HandleEnd is called after a command and all its assertions have been processed. // This method has no direct cmdt syntax equivalent but signals command completion. HandleEnd(ctx context.Context) error }
Handler provides callbacks for processing transcript operations. Each method corresponds to a specific cmdt opcode or interpreter event.
type Interpreter ¶
type Interpreter struct { // Input parameters. Handler Handler // Exposed state. Lineno int // Line currently executing. Command string // Text of the most recently executed command. CommandLineno int // Line of the most recently executed command. // contains filtered or unexported fields }
Interprets a transcript file.
func (*Interpreter) ExecLine ¶
func (t *Interpreter) ExecLine(ctx context.Context, text string) error
func (*Interpreter) ExecTranscript ¶
type Recorder ¶
type Recorder struct { // If provided, tees Stdout to this writer in addition to the buffer. Stdout io.Writer // If provided, tees Stderr to this writer in addition to the buffer. Stderr io.Writer // Transcript captures the recorded output in cmdt format. Transcript bytes.Buffer // contains filtered or unexported fields }
Recorder is a shell Interpreter that captures a command transcript into the Transcript byte buffer.
func (*Recorder) RecordComment ¶
func (*Recorder) RunCommand ¶
func (*Recorder) SetPreferredFiles ¶
SetPreferredFiles sets the list of preferred filenames in order. Files should be provided in deterministic order (stderr first, then stdout).
type Updater ¶
type Updater struct {
// contains filtered or unexported fields
}
func (*Updater) HandleComment ¶
func (*Updater) HandleExitCode ¶
func (*Updater) HandleFileOutput ¶
func (*Updater) HandleNoNewline ¶
func (*Updater) HandleOutput ¶
Click to show internal directories.
Click to hide internal directories.