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 ¶
- func HandledKinds(t *testing.T, file, fn string) []string
- func ReceiverMethods(t *testing.T, dir, typeName string) []string
- func RequireFieldType(t *testing.T, surface string, fields map[string]string, field, wantType string, ...)
- func RequireNoPrivatePaneLayoutCodec(t *testing.T, surface string, methods []string)
- func RequireSameKinds(t *testing.T, surface string, declared, dispatched []string)
- func StructFields(t *testing.T, file, typeName string) map[string]string
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func HandledKinds ¶
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
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
RequireNoPrivatePaneLayoutCodec fails when a host still encodes or decodes PaneLayoutJSON itself rather than through panecodec.
func RequireSameKinds ¶
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
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.