matchers

package
v0.0.0-...-4fd413f Latest Latest
Warning

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

Go to latest
Published: Apr 25, 2017 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type BeAnythingMatcher

type BeAnythingMatcher struct{}

BeAnythingMatcher matches _any_ value including nil and zero values.

func (*BeAnythingMatcher) FailureMessage

func (m *BeAnythingMatcher) FailureMessage(actual interface{}) string

FailureMessage returns a description of why the matcher did not match.

func (*BeAnythingMatcher) Match

func (m *BeAnythingMatcher) Match(actual interface{}) (bool, error)

Match always returns true.

func (*BeAnythingMatcher) NegatedFailureMessage

func (m *BeAnythingMatcher) NegatedFailureMessage(actual interface{}) string

NegatedFailureMessage returns a description of why the matcher matched.

type HaveCallMatcher

type HaveCallMatcher struct {
	Method string
	Params []types.Matcher
	Count  int
}

HaveCallMatcher consults the spy of a test double in order to verify that method calls were received with specified parameters.

func (*HaveCallMatcher) FailureMessage

func (sm *HaveCallMatcher) FailureMessage(actual interface{}) (message string)

FailureMessage returns an explanation of the method call that was expected.

func (*HaveCallMatcher) Match

func (sm *HaveCallMatcher) Match(actual interface{}) (bool, error)

Match verifies that a method was called on a mock

func (*HaveCallMatcher) NegatedFailureMessage

func (sm *HaveCallMatcher) NegatedFailureMessage(actual interface{}) (message string)

NegatedFailureMessage returns an explanation of the method call that was unexpected.

func (*HaveCallMatcher) Never

func (sm *HaveCallMatcher) Never() *HaveCallMatcher

Never is a shortcut for Times(0)

func (*HaveCallMatcher) Once

func (sm *HaveCallMatcher) Once() *HaveCallMatcher

Once is a shortcut for Times(1).

func (*HaveCallMatcher) Times

func (sm *HaveCallMatcher) Times(number int) *HaveCallMatcher

Times adds an expectation about the number of times a method was called.

func (*HaveCallMatcher) Twice

func (sm *HaveCallMatcher) Twice() *HaveCallMatcher

Twice is a shortcut for Times(2).

func (*HaveCallMatcher) With

func (sm *HaveCallMatcher) With(params ...interface{}) *HaveCallMatcher

With adds an expectation about method parameters.

type HaveTypeMatcher

type HaveTypeMatcher struct {
	Expected string
}

HaveTypeMatcher matches any value whose type matches the specified name. Named types must be prefixed with the name of the package in which they are defined (i.e. with the name that appears in the package statement of the source file where they are defined).

func (*HaveTypeMatcher) FailureMessage

func (m *HaveTypeMatcher) FailureMessage(actual interface{}) string

FailureMessage returns a description of why the matcher did not match.

func (*HaveTypeMatcher) Match

func (m *HaveTypeMatcher) Match(actual interface{}) (bool, error)

Match returns true if the type name of actual is similar to the expected name. The type name of actual is determined by calling reflect.TypeOf().

func (*HaveTypeMatcher) NegatedFailureMessage

func (m *HaveTypeMatcher) NegatedFailureMessage(actual interface{}) string

NegatedFailureMessage returns a description of why the matcher matched.

Jump to

Keyboard shortcuts

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