runner

package
v0.4.13 Latest Latest
Warning

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

Go to latest
Published: Aug 10, 2026 License: MIT Imports: 12 Imported by: 0

Documentation

Overview

Package runner provides shared conformance-fixture test helpers.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AssertCanonicalJSONEqual added in v0.4.13

func AssertCanonicalJSONEqual(t testing.TB, want, got any, label string)

AssertCanonicalJSONEqual fails the test when want and got differ as canonical JSON. Values marshal first, so raw JSON (json.RawMessage) and Go values compare alike; label, when non-empty, prefixes the failure.

func ByteDiff

func ByteDiff(want, got []byte) string

ByteDiff reports the first differing byte with compact quoted context.

func CanonicalJSON

func CanonicalJSON(data []byte) ([]byte, error)

CanonicalJSON normalizes insignificant JSON whitespace and object-key order.

func CanonicalJSONLexemes

func CanonicalJSONLexemes(data []byte) ([]byte, error)

CanonicalJSONLexemes sorts object keys while retaining scalar JSON spellings. It is used for wire fixtures where "<" and "\u003c", or 1 and 1.0, are semantically equal JSON but observably different protocol bytes.

func DecodeJSONLines

func DecodeJSONLines(data []byte) ([]json.RawMessage, error)

DecodeJSONLines validates strict LF-delimited JSONL and returns the original line bytes. Each line must contain exactly one JSON value and the stream must end immediately after a final LF.

func FixtureRoot

func FixtureRoot() string

FixtureRoot returns the absolute path to the committed fixture tree.

func LoadJSON

func LoadJSON(t testing.TB, family, name string, target any)

LoadJSON loads one JSON fixture or fails the calling test.

func LoadJSONLines

func LoadJSONLines(t testing.TB, family, name string) []json.RawMessage

LoadJSONLines loads and validates one JSONL fixture or fails the calling test.

func NormalizeFixturePath added in v0.4.13

func NormalizeFixturePath(value, root string) string

NormalizeFixturePath rewrites root (and its symlink alias) to "<fixture>", with forward slashes, so observed paths are host-independent.

func ReadFixture

func ReadFixture(family, name string) ([]byte, error)

ReadFixture reads one file from a fixture family. name may be a slash-separated relative subpath (e.g. "cases/export-surface.json").

func ReplacePathAliases

func ReplacePathAliases(value, path, replacement string) string

ReplacePathAliases replaces both a path and its realpath alias.

Types

type Manifest

type Manifest struct {
	Family         string   `json:"family"`
	UpstreamCommit string   `json:"upstreamCommit"`
	Generator      string   `json:"generator"`
	Source         string   `json:"source"`
	Files          []string `json:"files"`
}

Manifest identifies the upstream source and generator for a fixture family.

func LoadManifest

func LoadManifest(t testing.TB, family string) Manifest

LoadManifest loads a fixture family's manifest or fails the calling test.

Jump to

Keyboard shortcuts

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