parityscan

package
v1.8.0 Latest Latest
Warning

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

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

Documentation

Overview

Package parityscan is test support for the surface-parity contract around targetactivation plans.

Each activating surface declares which plan kinds it handles (`…HandlesPlanKind`) and separately dispatches them in a switch. The declaration is what the parity pair asserts against, so on its own it proves an intention rather than a behaviour: a kind added to the declaration but never given a branch would pass while a click on it did nothing. This package reads both out of the source and lets a surface require that they name exactly the same kinds, which is the cheapest way to make the two impossible to drift apart.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func HandledKinds

func HandledKinds(t *testing.T, file, fn string) []string

HandledKinds returns the targetactivation.Plan* constants named by the case clauses of the switch inside fn, as it is written in file. The file path is relative to the package directory, which is where `go test` runs.

func ReceiverMethods added in v1.8.0

func ReceiverMethods(t *testing.T, dir, typeName string) []string

ReceiverMethods returns the method names declared on typeName in dir, from non-test files. Spread methods are the usual Go case; parsing one file is how a codec would hide in a neighbour.

func RequireFieldType added in v1.8.0

func RequireFieldType(t *testing.T, surface string, fields map[string]string, field, wantType string, forbidden ...string)

RequireFieldType holds one shared ownership seam and its legacy exclusions.

func RequireNoPrivatePaneLayoutCodec added in v1.8.0

func RequireNoPrivatePaneLayoutCodec(t *testing.T, surface string, methods []string)

RequireNoPrivatePaneLayoutCodec fails when a host still encodes or decodes PaneLayoutJSON itself rather than through panecodec.

func RequireSameKinds

func RequireSameKinds(t *testing.T, surface string, declared, dispatched []string)

RequireSameKinds fails when a surface declares a kind it does not dispatch, or dispatches one it does not declare.

func StructFields added in v1.8.0

func StructFields(t *testing.T, file, typeName string) map[string]string

StructFields returns the written field types of one named struct. It lets a parity test hold a shared-state seam in place without importing either host or duplicating runtime behavior in test support.

Types

This section is empty.

Jump to

Keyboard shortcuts

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