testing

package
v2.3.1 Latest Latest
Warning

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

Go to latest
Published: Jul 29, 2019 License: MIT Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ErrorWithCodeMatcher

type ErrorWithCodeMatcher struct {
	Expected interface{}
}

ErrorWithCodeMatcher is the matcher that can find ErrorWithCode in the error chain and check its value.

func ErrorWithCode

func ErrorWithCode(code string) *ErrorWithCodeMatcher

ErrorWithCode goes through the error chain verifying if there is any `ErrorWithCode`. If an ErrorWithCode is found, it checks the Code. If it cannot find, an failure is reported.

func (*ErrorWithCodeMatcher) FailureMessage

func (matcher *ErrorWithCodeMatcher) FailureMessage(actual interface{}) (message string)

FailureMessage formats the error message for an error code not found.

func (*ErrorWithCodeMatcher) Match

func (matcher *ErrorWithCodeMatcher) Match(actual interface{}) (r bool, rErr error)

Match iterates through the error chain trying to find the ErrorWithCode. If it is found, this method performs the the check.

func (*ErrorWithCodeMatcher) NegatedFailureMessage

func (matcher *ErrorWithCodeMatcher) NegatedFailureMessage(actual interface{}) (message string)

FailureMessage formats the error message for an error code not found.

type ErrorWithModuleMatcher

type ErrorWithModuleMatcher struct {
	Expected interface{}
}

ErrorWithModuleMatcher is the matcher that can find ErrorWithModule in the error chain and check its value.

func ErrorWithModule

func ErrorWithModule(module string) *ErrorWithModuleMatcher

ErrorWithModule goes through the error chain verifying if there is any `ErrorWithModule`. If an ErrorWithModule is found, it checks the module. If it cannot find, an failure is reported.

func (*ErrorWithModuleMatcher) FailureMessage

func (matcher *ErrorWithModuleMatcher) FailureMessage(actual interface{}) (message string)

FailureMessage formats the error message for an error module not found.

func (*ErrorWithModuleMatcher) Match

func (matcher *ErrorWithModuleMatcher) Match(actual interface{}) (r bool, rErr error)

Match iterates through the error chain trying to find the ErrorWithModule. If it is found, this method performs the the check.

func (*ErrorWithModuleMatcher) NegatedFailureMessage

func (matcher *ErrorWithModuleMatcher) NegatedFailureMessage(actual interface{}) (message string)

FailureMessage formats the error message for an error module not found.

type ErrorWithReasonMatcher

type ErrorWithReasonMatcher struct {
	Expected error
}

func ErrorWithReason

func ErrorWithReason(err error) *ErrorWithReasonMatcher

ErrorWithReason goes through the error chain verifying if there is any `Reason` is equal to the one

func (*ErrorWithReasonMatcher) FailureMessage

func (matcher *ErrorWithReasonMatcher) FailureMessage(actual interface{}) (message string)

func (*ErrorWithReasonMatcher) Match

func (matcher *ErrorWithReasonMatcher) Match(actual interface{}) (r bool, rErr error)

func (*ErrorWithReasonMatcher) NegatedFailureMessage

func (matcher *ErrorWithReasonMatcher) NegatedFailureMessage(actual interface{}) (message string)

type ErrorWithValidatorMatcher

type ErrorWithValidatorMatcher struct {
	Field string
	Rule  string
}

ErrorWithValidatorMatcher as struct for validating errors

func ErrorWithValidation

func ErrorWithValidation(field string, rule string) *ErrorWithValidatorMatcher

ErrorWithValidation goes through the error chain verifying if there is any `Validation` is equal to errors

func (*ErrorWithValidatorMatcher) FailureMessage

func (matcher *ErrorWithValidatorMatcher) FailureMessage(actual interface{}) (message string)

FailureMessage ...

func (*ErrorWithValidatorMatcher) Match

func (matcher *ErrorWithValidatorMatcher) Match(actual interface{}) (bool, error)

Match ...

func (*ErrorWithValidatorMatcher) NegatedFailureMessage

func (matcher *ErrorWithValidatorMatcher) NegatedFailureMessage(actual interface{}) (message string)

NegatedFailureMessage ...

type HttpErrorMatcher

type HttpErrorMatcher struct {
	Expected int
}

HttpErrorMatcher is the matcher that can find HttpError in the error chain and check its value.

func HttpStatus

func HttpStatus(code int) *HttpErrorMatcher

HttpError goes through the error chain verifying if there is any `HttpError`. If an HttpError is found, it checks the Code. If it cannot find, an failure is reported.

func (*HttpErrorMatcher) FailureMessage

func (matcher *HttpErrorMatcher) FailureMessage(actual interface{}) (message string)

FailureMessage formats the error message for an error code not found.

func (*HttpErrorMatcher) Match

func (matcher *HttpErrorMatcher) Match(actual interface{}) (r bool, rErr error)

Match iterates through the error chain trying to find the HttpError. If it is found, this method performs the the check.

func (*HttpErrorMatcher) NegatedFailureMessage

func (matcher *HttpErrorMatcher) NegatedFailureMessage(actual interface{}) (message string)

FailureMessage formats the error message for an error code not found.

Jump to

Keyboard shortcuts

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