gitfail

package
v0.25.0 Latest Latest
Warning

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

Go to latest
Published: Nov 16, 2026 License: MIT Imports: 6 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 gitfail puts a git on PATH that runs the real git except where a test wants a call to fail or print nothing. It lets a test reach the error returns of git calls that succeed on any real repository.

Each function sets PATH with t.Setenv, so a test that calls one MUST NOT run in parallel.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func SilentWhenArg

func SilentWhenArg(t *testing.T, arg string)

SilentWhenArg makes git exit 0 and print nothing when one of its arguments equals arg.

func WhenArg

func WhenArg(t *testing.T, arg string, code int)

WhenArg makes git exit with code, and "injected failure" on stderr, when one of its arguments equals arg. A config lookup reads exit 1 as an unset key, so a test that wants its error return passes 2.

func WhenContains

func WhenContains(t *testing.T, pattern string)

WhenContains makes git exit 2 with "injected failure" on stderr when its arguments, joined by spaces, contain pattern. Exit code 2 is neither of the codes gitx reads as an answer, so the call fails as any broken git would.

Types

This section is empty.

Jump to

Keyboard shortcuts

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