Documentation
¶
Overview ¶
Package ffmpegtest provides fake ffmpeg and ffprobe binaries for tests.
A fake is the running test binary itself, reached through a symlink named after the fake. Install writes what the fake does to a data file beside the symlink, and Dispatch, called first in the package's TestMain, acts it out when the binary starts under that name. No executable file is ever written, so running a fake can never fail with "text file busy".
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Case ¶
type Case struct {
// Arg is the argument that selects the case.
Arg string `json:"arg"`
// Stdout is written to standard output.
Stdout string `json:"stdout"`
// Stderr is written to standard error.
Stderr string `json:"stderr"`
// ExitCode is the status the fake exits with.
ExitCode int `json:"exitCode"`
// Output, when set, is written to the file named by the last argument.
Output string `json:"output"`
}
Case is what a fake does instead for a run whose arguments include Arg.
type Stub ¶
type Stub struct {
// Stdout is written to standard output.
Stdout string `json:"stdout"`
// Stderr is written to standard error.
Stderr string `json:"stderr"`
// ExitCode is the status the fake exits with.
ExitCode int `json:"exitCode"`
// Swap names a file the fake replaces with replacement.mkv from the same
// directory before it writes anything, so a cache keyed on the file's
// identity sees it change mid-run.
Swap Swap `json:"swap"`
// ArgvFile, when set, receives every argument on its own line.
ArgvFile string `json:"argvFile"`
// ArgvSeparator, when set, is appended to ArgvFile after the arguments, so
// several runs can be told apart.
ArgvSeparator string `json:"argvSeparator"`
// ArgvBesideOutput appends every argument to "<last argument>.argv".
ArgvBesideOutput bool `json:"argvBesideOutput"`
// Output, when set, is written to the file named by the last argument.
Output string `json:"output"`
// Cases replace Stdout, Stderr, ExitCode, and Output for a run whose
// arguments include a case's Arg, so one fake can answer each kind of
// call a caller makes. The first case that matches wins.
Cases []Case `json:"cases"`
}
Stub is what a fake binary does when it runs.
Click to show internal directories.
Click to hide internal directories.