Documentation
¶
Overview ¶
Package runner provides shared conformance-fixture test helpers.
Index ¶
- func AssertCanonicalJSONEqual(t testing.TB, want, got any, label string)
- func ByteDiff(want, got []byte) string
- func CanonicalJSON(data []byte) ([]byte, error)
- func CanonicalJSONLexemes(data []byte) ([]byte, error)
- func DecodeJSONLines(data []byte) ([]json.RawMessage, error)
- func FixtureRoot() string
- func LoadJSON(t testing.TB, family, name string, target any)
- func LoadJSONLines(t testing.TB, family, name string) []json.RawMessage
- func NormalizeFixturePath(value, root string) string
- func ReadFixture(family, name string) ([]byte, error)
- func ReplacePathAliases(value, path, replacement string) string
- type Manifest
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func AssertCanonicalJSONEqual ¶ added in v0.4.13
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 CanonicalJSON ¶
CanonicalJSON normalizes insignificant JSON whitespace and object-key order.
func CanonicalJSONLexemes ¶
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 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
NormalizeFixturePath rewrites root (and its symlink alias) to "<fixture>", with forward slashes, so observed paths are host-independent.
func ReadFixture ¶
ReadFixture reads one file from a fixture family. name may be a slash-separated relative subpath (e.g. "cases/export-surface.json").
func ReplacePathAliases ¶
ReplacePathAliases replaces both a path and its realpath alias.