eachers

package module
v0.0.0-...-2394292 Latest Latest
Warning

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

Go to latest
Published: Oct 20, 2018 License: MIT Imports: 6 Imported by: 0

README

eachers

Gomega matchers that integrate with hel mocks.

hel uses channels to store the history of a method. This allows tests to assert that the file was called any number of times in a go-routine safe way.

While Gomega has matchers for channels (e.g. Receive), they don't lend themselves to asserting for multiple values. eachers is intended to fill that void.

Provided Matchers

###EqualEach###

Expect(helChannel).To(EqualEach(1,2,3))

###BeEquivalentToEach###

Expect(helChannel).To(BeEquivalentToEach(1,2,3))

###Each###

Expect(helChannel).To(Each(BeEquivalentTo,1,2,3))

Note: Each is actually used by both EqualEach and BeEquivalentToEach.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func BeEquivalentToEach

func BeEquivalentToEach(values ...interface{}) gomegaTypes.GomegaMatcher

func Each

func Each(matcherFactory func(interface{}) gomegaTypes.GomegaMatcher, values ...interface{}) gomegaTypes.GomegaMatcher

func EqualEach

func EqualEach(values ...interface{}) gomegaTypes.GomegaMatcher

func With

func With(args ...interface{}) []interface{}

With is just sugar so you can type `BeCalled(With(arg0, arg1))` instead of `BeCalled([]interface{}{arg0, arg1})`

Types

type Called

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

Called is a gomega/types.GomegaMatcher that asserts on method calls for mocks generated by github.com/nelsam/hel

func BeCalled

func BeCalled(calls ...[]interface{}) *Called

BeCalled takes 0 or more slices of arguments and returns a Called matcher for those arguments.

func (*Called) FailureMessage

func (c *Called) FailureMessage(actual interface{}) (message string)

FailureMessage returns the message when c failed to match a call.

func (*Called) Match

func (c *Called) Match(actual interface{}) (success bool, err error)

Match asserts that actual was called. If there are any argument slices in c, it will assert that actual was called with those arguments.

func (*Called) NegatedFailureMessage

func (c *Called) NegatedFailureMessage(actual interface{}) (message string)

NegatedFailureMessage returns the message when c matched a call and shouldn't have.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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