Help us shape the future of Go! Take the 2026 Go Developer Survey

assert

package
v0.26.0 Latest Latest
Warning

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

Go to latest
Published: Oct 1, 2026 License: Apache-2.0 Imports: 2 Imported by: 0

Documentation

Overview

Package assert is the testing seam for the test-case corpus: helpers that take *testing.T and fail a test when a corpus violates its own invariants. It lives in its own subpackage so the pure-data package github.com/peasant-labs/schema/testcase never imports testing.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func RequireMin

func RequireMin[I any, E any](t *testing.T, corpus testcase.Corpus[I, E], n int)

RequireMin fails the test (t.Fatalf) unless the corpus holds at least n cases. It is the loud, testing-side wrapper around Corpus.CheckMin: a corpus that was silently gutted, or never loaded, trips it here instead of passing vacuously. The size logic itself lives in the pure CheckMin so it can be negative-tested without a *testing.T.

func RequireValid

func RequireValid[I any, E any](t *testing.T, corpus testcase.Corpus[I, E])

RequireValid fails the test (t.Fatalf) unless every case in the corpus is non-vacuous: an in-set classification and provenance source, a non-empty provenance ref, and a non-empty mutation description. It is the loud, testing-side wrapper around the pure Corpus.Validate, symmetric to RequireMin around CheckMin: the validity logic lives in Validate so it can be negative-tested without a *testing.T. A guard call names the arm it guards by its call site, so a segmented fixture pairs it with RequireMin per arm.

Types

This section is empty.

Jump to

Keyboard shortcuts

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