testutil

package
v2.0.14 Latest Latest
Warning

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

Go to latest
Published: May 24, 2025 License: Apache-2.0 Imports: 12 Imported by: 0

Documentation

Overview

Utilities for unit testing this project.

Index

Constants

View Source
const InitialCommitSubject = "Initial empty commit"

Variables

View Source
var TestWorkingDir string

Functions

func AddCommit

func AddCommit(commitMessage string, filename string)

func CommitFileChange

func CommitFileChange(commitMessage string, filename string, fileContents string)

func InitTest

func InitTest(t *testing.T, logLevel slog.Level) *util.TestExecutor

CD into repository directory and set any global DI variables (slog, sleep, and executor).

Types

type WriteRecorder

type WriteRecorder struct {
	// contains filtered or unexported fields
}

An io.Writer that outputs to a string and also to Stdout. Useful for testing so that log output can still be seen in the output of the test if the test failed, and the output of the program can be asserted against.

func NewWriteRecorder

func NewWriteRecorder() *WriteRecorder

Creates a new WriteRecorder that writes to Stdout.

func (*WriteRecorder) String

func (r *WriteRecorder) String() string

func (*WriteRecorder) Write

func (r *WriteRecorder) Write(p []byte) (n int, err error)

Jump to

Keyboard shortcuts

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