runner

package
v0.4.9 Latest Latest
Warning

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

Go to latest
Published: Jul 28, 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 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 ReadFixture

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

ReadFixture reads one file from a fixture family.

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