test

package
v1.5.3 Latest Latest
Warning

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

Go to latest
Published: Oct 16, 2019 License: MIT Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func BodySpecErrors

func BodySpecErrors(r Errorer, spec BodySpec, body codec.Body) bool

func PacketSpecErrors

func PacketSpecErrors(r Errorer, spec PacketSpec, pkt DirectedPacket) bool

func TranscriptSpecErrors

func TranscriptSpecErrors(r Errorer, spec TranscriptSpec, ts *Transcript) bool

func Wrap

Wrap decodes every packet that passes through it and logs it

func WrapConn

func WrapConn(ts *Transcript, conn net.Conn) net.Conn

Types

type BodySpec

type BodySpec func(Errorer, codec.Body)

func ContainsBodySpec

func ContainsBodySpec(exp codec.Body) BodySpec

func EqualBodySpec

func EqualBodySpec(exp codec.Body) BodySpec

func MergeBodySpec

func MergeBodySpec(specs ...BodySpec) BodySpec

type DirectedPacket

type DirectedPacket struct {
	*codec.Packet
	Dir Direction
	Err error
}

type Direction

type Direction bool
const (
	DirOut Direction = false
	DirIn  Direction = true
)

func (Direction) String

func (dir Direction) String() string

type DoesErrorer

type DoesErrorer bool

func (*DoesErrorer) Error

func (de *DoesErrorer) Error(...interface{})

func (*DoesErrorer) Errorf

func (de *DoesErrorer) Errorf(string, ...interface{})

type Errorer

type Errorer interface {
	Error(v ...interface{})
	Errorf(fmt string, v ...interface{})
}

func ErrorerWithPrefix

func ErrorerWithPrefix(r Errorer, prefix ...interface{}) Errorer

func MultiErrorer

func MultiErrorer(rs ...Errorer) Errorer

type LineErrorer

type LineErrorer struct {
	// contains filtered or unexported fields
}

func (LineErrorer) Error

func (lr LineErrorer) Error(v ...interface{})

func (LineErrorer) Errorf

func (lr LineErrorer) Errorf(format string, v ...interface{})

type PacketSpec

type PacketSpec func(Errorer, DirectedPacket)

func BodyPacketSpec

func BodyPacketSpec(spec BodySpec) PacketSpec

func CallPacketSpec

func CallPacketSpec(stream bool, flagJSON bool, method muxrpc.Method, tipe muxrpc.CallType, args ...interface{}) PacketSpec

func DirPacketSpec

func DirPacketSpec(dir Direction) PacketSpec

func ErrorPacketSpec

func ErrorPacketSpec(errStr string) PacketSpec

func FlagEqualPacketSpec

func FlagEqualPacketSpec(flag codec.Flag) PacketSpec

func FlagSetPacketSpec

func FlagSetPacketSpec(flag codec.Flag, expected bool) PacketSpec

func MergePacketSpec

func MergePacketSpec(specs ...PacketSpec) PacketSpec

func NoErrorPacketSpec

func NoErrorPacketSpec() PacketSpec

func ReqPacketSpec

func ReqPacketSpec(req int32) PacketSpec

type Transcript

type Transcript struct {
	// contains filtered or unexported fields
}

func (*Transcript) Append

func (ts *Transcript) Append(dir Direction, pkt *codec.Packet)

func (*Transcript) AppendError

func (ts *Transcript) AppendError(dir Direction, err error)

func (*Transcript) Get

func (ts *Transcript) Get() []DirectedPacket

type TranscriptSpec

type TranscriptSpec func(Errorer, *Transcript)

func LengthTranscriptSpec

func LengthTranscriptSpec(n int) TranscriptSpec

func MatchCountTranscriptSpec

func MatchCountTranscriptSpec(spec PacketSpec, n int) TranscriptSpec

func MergeTranscriptSpec

func MergeTranscriptSpec(specs ...TranscriptSpec) TranscriptSpec

func OrderTranscriptSpec

func OrderTranscriptSpec(before, after PacketSpec) TranscriptSpec

func UniqueMatchTranscriptSpec

func UniqueMatchTranscriptSpec(spec PacketSpec) TranscriptSpec

Jump to

Keyboard shortcuts

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