testutil

package
v0.0.0-...-344772a Latest Latest
Warning

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

Go to latest
Published: Nov 16, 2026 License: Apache-2.0 Imports: 10 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 holds the helpers that the tests of several packages share.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AssertGolden

func AssertGolden(t testing.TB, path string, update bool, v any)

AssertGolden compares the indented JSON form of v with the golden file at path. With update it writes the file first.

func HashFiles

func HashFiles(t testing.TB, names []string) string

HashFiles returns the hash of the files, by base name, in the order given.

Types

type Hasher

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

Hasher hashes named byte sequences in order, so a set of golden files or of outputs has one hash that a version table records.

func NewHasher

func NewHasher() *Hasher

func (*Hasher) Add

func (h *Hasher) Add(t testing.TB, name string, data []byte)

Add hashes the name, the length and the bytes of one item.

func (*Hasher) Sum

func (h *Hasher) Sum() string

Sum returns the hash so far in hex.

Jump to

Keyboard shortcuts

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