testx

package
v0.3.0 Latest Latest
Warning

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

Go to latest
Published: Oct 21, 2026 License: Apache-2.0 Imports: 7 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 testx holds what the tests of several packages share: the mark of a test that checks portable logic, which the Windows job skips (CONTRIBUTING.md), and the environment every test process starts from (Guard).

Index

Constants

View Source
const SystemOnly = "DJINN_TEST_SYSTEM_ONLY"

SystemOnly is the variable that keeps only the tests that target the system: the Windows job of CI sets it to 1.

Variables

This section is empty.

Functions

func Guard added in v0.1.1

func Guard() func()

Guard sets DJINN_HOME and DJINN_ADDR to a temporary directory before tests run, so an inherited value is never used. It also sets DJINN_TEST=1, and hides the machine's git identity (HideGitIdentity). It returns a cleanup function to restore the environment and delete the directory.

func HideGitIdentity added in v0.1.1

func HideGitIdentity(dir string) error

HideGitIdentity leaves git, in this process and the ones it starts, as a CI runner has it: no identity, so that a commit fails with "empty ident name" where a developer's machine would sign it with theirs. A test repository that commits sets its own identity (git config user.name); Djinn's merges run in such repositories. The global config is still read, through an include in a file of dir that GIT_CONFIG_GLOBAL names, for its other settings (the Windows job's core.longpaths), and its user.name is emptied after it; a repository's own config comes after both.

func Main added in v0.1.1

func Main(m *testing.M)

Main runs m after setting DJINN_HOME and DJINN_ADDR to a temporary directory with Guard, and exits with m's code.

func Portable

func Portable(t testing.TB)

Portable marks a test that pays for git, processes or a whole djinn up to check Djinn's own logic, the same on every system: it skips where SystemOnly is 1, as Linux and macOS prove it. Never mark a test that reaches a _windows.go file, a runtime.GOOS branch, paths, processes or the terminal: that is what Windows must run.

Types

type HeldCheckout added in v0.2.0

type HeldCheckout struct {
	// Env holds the variables that make a git command hold: add them to its environment.
	Env []string
	// contains filtered or unexported fields
}

HeldCheckout holds a git mid-way through writing a file to a worktree, as a reset, a checkout or a merge does, its index.lock taken: what a stop or a kill finds when it cuts one (W52). Unix only: the filter is a shell script.

func HoldCheckout added in v0.2.0

func HoldCheckout(t testing.TB, common string) *HeldCheckout

HoldCheckout makes git, in the repository whose common folder is common (".git" of the main checkout), hold in a smudge filter for every file it writes, when started with h.Env; other gits are left alone. The filter lets go of the file once Release is called, and the test's end calls it.

func (*HeldCheckout) Held added in v0.2.0

func (h *HeldCheckout) Held(t testing.TB) int

Held waits for a git to hold, and returns its filter's process ID.

func (*HeldCheckout) Release added in v0.2.0

func (h *HeldCheckout) Release()

Release lets the held git write its file and go on.

Directories

Path Synopsis
Package bigwish makes a wish of real size, to measure Djinn on: its azimas and tasks, the events of their workers, its questions and decisions, its blocks and its journal, as a wish export (WishService.Import reads it).
Package bigwish makes a wish of real size, to measure Djinn on: its azimas and tasks, the events of their workers, its questions and decisions, its blocks and its journal, as a wish export (WishService.Import reads it).

Jump to

Keyboard shortcuts

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