testutil

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Oct 11, 2026 License: MIT Imports: 8 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 testutil builds throwaway Git registries for tests.

Importing it isolates git from the developer's configuration (see IsolateGit).

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CountGit

func CountGit(t *testing.T) func() []string

CountGit routes the git commands of the test through a wrapper that records them, and returns a function listing the commands run since (their arguments, one string per command). It changes PATH: not for parallel tests.

func IsolateGit

func IsolateGit()

IsolateGit makes every git command of the test process ignore the developer's global and system configuration (signing, hooks, templates, credential helpers…) and use a fixed identity. Test binaries that run git without importing this package call it from TestMain.

func Marketplace

func Marketplace(plugins ...string) string

Marketplace returns a marketplace.json listing in-repo plugins under plugins/.

func Network

func Network(commands []string) []string

Network keeps the commands that talk to the remote.

func SkillMD

func SkillMD(name, body string) string

SkillMD returns a valid SKILL.md.

func SkillPath

func SkillPath(plugin, name string) string

SkillPath returns the path of a skill's SKILL.md inside a registry.

Types

type Origin

type Origin struct {
	Dir string
	// contains filtered or unexported fields
}

Origin is a non-bare Git repository acting as a remote registry.

func NewLargeOrigin

func NewLargeOrigin(t *testing.T, n int, governance string) *Origin

NewLargeOrigin creates a registry of n plugins holding one skill each ("p<i>:s<i>"), with governance as skillcrew.yaml. It uses git fast-import, so registries of thousands of plugins are created in a second. The working tree is left empty to save disk space: run "git reset --hard" before Write and Commit.

func NewOrigin

func NewOrigin(t *testing.T, files map[string]string) *Origin

NewOrigin creates a repository on branch main with files committed.

func (*Origin) Commit

func (o *Origin) Commit(msg string) string

Commit commits everything and returns the commit id.

func (*Origin) Git

func (o *Origin) Git(args ...string) string

Git runs git in the repository.

func (*Origin) Write

func (o *Origin) Write(files map[string]string)

Write creates or overwrites files.

Jump to

Keyboard shortcuts

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