conformance

package
v0.0.2 Latest Latest
Warning

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

Go to latest
Published: Jul 15, 2026 License: MIT Imports: 4 Imported by: 0

Documentation

Overview

Package conformance is the executable contract of events.Broker.

The interface states the SIGNATURES; this package states the BEHAVIOUR — the same role github.com/tinywasm/router/conformance plays for router.Router. Two brokers can satisfy events.Broker and disagree on what matters (does a subscriber to topic A see an event published on topic B? does a second subscriber on the same topic see anything at all?). That has to become something that goes red, not folklore.

An implementation proves conformance from its own test package:

func TestMockConformance(t *testing.T) {
    conformance.Run(t, conformance.Factory{New: func(t *testing.T) events.Broker { return &mock.Broker{} }})
}

Index

Constants

View Source
const (
	TopicA = "conformance.a"
	TopicB = "conformance.b"
)

TopicA and TopicB are the two topics the suite drives its cases with.

Variables

This section is empty.

Functions

func Run

func Run(t *testing.T, f Factory)

Run executes every clause of the contract against the implementation.

Types

type Factory

type Factory struct {
	New func(t *testing.T) events.Broker
}

Factory builds a fresh Broker for one case, so no case can be polluted by another's subscriptions.

type Fixture

type Fixture struct{ Value string }

Fixture is the minimal model.Encodable payload the suite publishes, so a clause can assert the FIELDS survived delivery — not just that some Event arrived.

func (*Fixture) EncodeFields

func (f *Fixture) EncodeFields(w model.FieldWriter)

func (*Fixture) IsNil

func (f *Fixture) IsNil() bool

Jump to

Keyboard shortcuts

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