exectest

package
v0.7.0 Latest Latest
Warning

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

Go to latest
Published: Oct 22, 2026 License: Apache-2.0 Imports: 5 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package exectest fakes adapter.Env.Exec for tests: commands are answered by the longest matching prefix of their command line.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Codes

func Codes(findings []adapter.Finding) []string

Codes lists the findings' codes.

Types

type Answer

type Answer struct {
	Stdout, Stderr string
	Err            error
}

Answer is what a fake command prints and returns.

func Missing

func Missing(name string) Answer

Missing is the answer of a command that isn't installed.

type Call

type Call struct {
	Line string
	Opts adapter.ExecOptions
}

type Fake

type Fake struct {
	Answers map[string]Answer
	Calls   []Call
}

Fake answers commands from Answers, by the longest prefix of the command line that has an answer; a command no prefix matches succeeds silently. Calls records each command line with its options.

func (*Fake) Env

func (f *Fake) Env(dir string) *adapter.Env

Env returns an Env whose commands f answers.

func (*Fake) Exec

func (f *Fake) Exec(_ context.Context, opts adapter.ExecOptions, name string, args ...string) error

Jump to

Keyboard shortcuts

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