enumcorpus

package
v0.1.3 Latest Latest
Warning

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

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

Documentation

Overview

Package enumcorpus generates the enum-exhaustion test corpora for the Local API 0.5.0 git+session timeline and insight-first code map closed sets (AssociationConclusion, AssociationEvidenceKind, Confidence, RewriteResolution, RewriteMethod, InsightKind, InsightProvenance, ReadAttributionState, ReadStateGrade) plus a regenerated TargetKind corpus (the file_version member added in the same tag).

It generalizes licensecorpus.BuildCorpus over any closed string enum instead of repeating that package's shape nine more times: one must-pass case per member plus a must-fail negative, each carrying enum provenance and a non-empty mutation description, rendered as committed YAML corpora in the schema/testcase shape. cmd/gen-enum-corpora writes one committed artifact per enum under testdata/, and enumcorpus_test.go guards each with the same two tests licensecorpus.go documents: an exhaustive-coverage test that reddens if the enum widens without the corpus regenerated, and a freshness gate that reddens if the committed file drifts from a fresh render.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func BuildCorpus

func BuildCorpus[T ClosedEnum](enumName, sourceRef string, all []T, negative T, negativeReason string) testcase.Corpus[T, bool]

BuildCorpus enumerates all into one must-pass case per member, then appends a single must-fail negative built from negative. Every case carries Source=SourceEnum, a concrete provenance ref, and a non-empty mutation description, so each case passes testcase.Case.Validate (never vacuous). Mirrors licensecorpus.BuildCorpus, generalized over any ClosedEnum.

func RenderCorpus

func RenderCorpus[T ClosedEnum](enumName, sourceRef string, all []T, negative T, negativeReason string) ([]byte, error)

RenderCorpus returns the committed artifact bytes for a corpus built by BuildCorpus: the generated header followed by its YAML encoding. It is deterministic, so the freshness gate can byte-compare it against the committed file.

Types

type ClosedEnum

type ClosedEnum interface {
	~string
	IsValid() bool
	String() string
}

ClosedEnum is the constraint every corpus in this package operates over: a named string type carrying the module's standard IsValid/String closed-set methods.

Jump to

Keyboard shortcuts

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