testutil

package
v0.1.1 Latest Latest
Warning

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

Go to latest
Published: Jun 16, 2026 License: MIT Imports: 5 Imported by: 0

Documentation

Overview

Package testutil provides helpers shared across test packages.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Repo

type Repo struct {
	Root  string
	Store *store.Store
	Index *index.Index
}

Repo is a fully initialized local repo in a temp directory, for use in tests.

func NewRepo

func NewRepo(t *testing.T) *Repo

NewRepo creates a temp directory, initializes the store and index, and registers cleanup. Tests that use this must NOT call t.Parallel() if they also change the working directory.

func (*Repo) ReadFile

func (r *Repo) ReadFile(t *testing.T, relPath string) string

ReadFile reads a file from the repo root. Fails the test if it doesn't exist.

func (*Repo) WriteFile

func (r *Repo) WriteFile(t *testing.T, relPath, content string)

WriteFile writes content to path (relative to repo root), creating parent dirs.

Jump to

Keyboard shortcuts

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