test

package
v0.10.1 Latest Latest
Warning

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

Go to latest
Published: Nov 26, 2019 License: Apache-2.0 Imports: 16 Imported by: 0

Documentation

Overview

Package test contains test data and generic tests for testing bindings.

Package test provides re-usable functions for binding tests.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AllVersions

func AllVersions(events []ce.Event) []ce.Event

AllVersions returns all versions of each event in events. ID gets a -number suffix so IDs are unique.

func AssertMessageEqual

func AssertMessageEqual(t testing.TB, x, y binding.Message)

AssertMessageEqual asserts that x and y are both structured or both binary and equal.

func AssertMessageEventEqual

func AssertMessageEventEqual(t testing.TB, x, y binding.Message)

AssertMessageEventEqual compares x.Event() and y.Event()

func BenchmarkSendReceive added in v0.10.1

func BenchmarkSendReceive(b *testing.B, s binding.Sender, r binding.Receiver)

Simpe send/receive benchmark. Requires a sender and receiver that are connected to each other.

func Canonical

func Canonical(t *testing.T, c ce.EventContext)

Canonical converts all attributes to canonical string form for comparisons.

func DiffMessageStruct

func DiffMessageStruct(x, y binding.Message) string

DiffMessageStruct compares x.Structured() and y.Structured()

func EachEvent

func EachEvent(t *testing.T, events []ce.Event, f func(*testing.T, ce.Event))

Run f as a test for each event in events

func EachMessage

func EachMessage(t *testing.T, messages []binding.Message, f func(*testing.T, binding.Message))

Run f as a test for each message in messages

func EncodeAll

func EncodeAll(t *testing.T, in []ce.Event, enc binding.Encoder) (out []binding.Message)

func EncodeDecode

func EncodeDecode(t *testing.T, in ce.Event, enc binding.Encoder) (out ce.Event)

EncodeDecode enc.Encode(); m.Decode(); return result. Halt test on error.

func Events

func Events() []ce.Event

Events is a set of test events that should be handled correctly by all event-processing code.

func FullEvent

func FullEvent() ce.Event

FullEvent has all context attributes set and JSON string data.

func MinEvent

func MinEvent() ce.Event

MinEvent has only required attributes set.

func MustJSON

func MustJSON(e ce.Event) []byte

func NameOf

func NameOf(x interface{}) string

NameOf generates a string test name from x, esp. for ce.Event and ce.Message.

func NoExtensions

func NoExtensions(events []ce.Event) []ce.Event

NoExtensions returns a copy of events with no Extensions. Use for testing where extensions are not supported.

func SendReceive

SendReceive does, s.Send(in) and returns r.Receive(). Halt test on error.

Types

This section is empty.

Jump to

Keyboard shortcuts

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