Documentation ¶
Index ¶
- type AsyncFuncCallRule
- type AsyncSucceedRule
- type AsyncTimeIntervalsRule
- type CapRule
- type ComparePointRule
- type ComparisonRule
- type DoubleNegativeRule
- type EqualBoolRule
- type EqualDifferentTypesRule
- type EqualNilRule
- type ErrorEqualNilRule
- type ForceExpectToRule
- type HaveLen0
- type HaveOccurredRule
- type LenRule
- type MatchErrorRule
- type MissingAssertionRule
- type NilCompareRule
- type Rule
- type Rules
- type SucceedRule
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type AsyncFuncCallRule ¶
type AsyncFuncCallRule struct{}
AsyncFuncCallRule checks that there is no function call actual parameter, in an async actual method (e.g. Eventually).
Async actual methods should get the function itself, not a function call, because then there is no async operation at all, and we're waiting for the function to be returned before calling the assertion.
We do allow functions that return a function, a channel or a pointer.
func (AsyncFuncCallRule) Apply ¶
func (r AsyncFuncCallRule) Apply(gexp *expression.GomegaExpression, config types.Config, reportBuilder *reports.Builder) bool
type AsyncSucceedRule ¶ added in v0.18.0
type AsyncSucceedRule struct{}
func (AsyncSucceedRule) Apply ¶ added in v0.18.0
func (r AsyncSucceedRule) Apply(gexp *expression.GomegaExpression, _ types.Config, reportBuilder *reports.Builder) bool
type AsyncTimeIntervalsRule ¶
type AsyncTimeIntervalsRule struct{}
func (AsyncTimeIntervalsRule) Apply ¶
func (r AsyncTimeIntervalsRule) Apply(gexp *expression.GomegaExpression, config types.Config, reportBuilder *reports.Builder) bool
type CapRule ¶
type CapRule struct{}
CapRule does not allow using the cap() function in actual with numeric comparison. it suggests to use the HaveLen matcher, instead.
func (*CapRule) Apply ¶
func (r *CapRule) Apply(gexp *expression.GomegaExpression, config types.Config, reportBuilder *reports.Builder) bool
type ComparePointRule ¶
type ComparePointRule struct{}
func (ComparePointRule) Apply ¶
func (r ComparePointRule) Apply(gexp *expression.GomegaExpression, config types.Config, reportBuilder *reports.Builder) bool
type ComparisonRule ¶
type ComparisonRule struct{}
func (ComparisonRule) Apply ¶
func (r ComparisonRule) Apply(gexp *expression.GomegaExpression, config types.Config, reportBuilder *reports.Builder) bool
type DoubleNegativeRule ¶
type DoubleNegativeRule struct{}
func (DoubleNegativeRule) Apply ¶
func (r DoubleNegativeRule) Apply(gexp *expression.GomegaExpression, _ types.Config, reportBuilder *reports.Builder) bool
type EqualBoolRule ¶
type EqualBoolRule struct{}
func (EqualBoolRule) Apply ¶
func (r EqualBoolRule) Apply(gexp *expression.GomegaExpression, _ types.Config, reportBuilder *reports.Builder) bool
type EqualDifferentTypesRule ¶
type EqualDifferentTypesRule struct{}
func (EqualDifferentTypesRule) Apply ¶
func (r EqualDifferentTypesRule) Apply(gexp *expression.GomegaExpression, config types.Config, reportBuilder *reports.Builder) bool
type EqualNilRule ¶
type EqualNilRule struct{}
EqualNilRule validate that there is no use of Equal(nil) in the code It is part of assertion only rules
func (EqualNilRule) Apply ¶
func (r EqualNilRule) Apply(gexp *expression.GomegaExpression, config types.Config, reportBuilder *reports.Builder) bool
type ErrorEqualNilRule ¶
type ErrorEqualNilRule struct{}
func (ErrorEqualNilRule) Apply ¶
func (r ErrorEqualNilRule) Apply(gexp *expression.GomegaExpression, config types.Config, reportBuilder *reports.Builder) bool
type ForceExpectToRule ¶
type ForceExpectToRule struct{}
func (ForceExpectToRule) Apply ¶
func (r ForceExpectToRule) Apply(gexp *expression.GomegaExpression, config types.Config, reportBuilder *reports.Builder) bool
type HaveLen0 ¶
type HaveLen0 struct{}
func (*HaveLen0) Apply ¶
func (r *HaveLen0) Apply(gexp *expression.GomegaExpression, config types.Config, reportBuilder *reports.Builder) bool
type HaveOccurredRule ¶ added in v0.18.0
type HaveOccurredRule struct{}
func (HaveOccurredRule) Apply ¶ added in v0.18.0
func (r HaveOccurredRule) Apply(gexp *expression.GomegaExpression, config types.Config, reportBuilder *reports.Builder) bool
type LenRule ¶
type LenRule struct{}
LenRule does not allow using the len() function in actual with numeric comparison. Instead, it suggests to use the HaveLen matcher, or the BeEmpty matcher, if comparing to zero.
func (*LenRule) Apply ¶
func (r *LenRule) Apply(gexp *expression.GomegaExpression, config types.Config, reportBuilder *reports.Builder) bool
type MatchErrorRule ¶
type MatchErrorRule struct{}
MatchErrorRule validates the usage of the MatchError matcher.
First, it checks that the actual value is actually an error ¶
Then, it checks the matcher itself: this matcher can be used in 3 different ways:
- With error type variable
- With another gomega matcher, to check the actual err.Error() value
- With function with a signature of func(error) bool. In this case, additional description string variable is required.
func (MatchErrorRule) Apply ¶
func (r MatchErrorRule) Apply(gexp *expression.GomegaExpression, _ types.Config, reportBuilder *reports.Builder) bool
type MissingAssertionRule ¶
type MissingAssertionRule struct{}
func (MissingAssertionRule) Apply ¶
func (r MissingAssertionRule) Apply(gexp *expression.GomegaExpression, _ types.Config, reportBuilder *reports.Builder) bool
type NilCompareRule ¶
type NilCompareRule struct{}
func (NilCompareRule) Apply ¶
func (r NilCompareRule) Apply(gexp *expression.GomegaExpression, config types.Config, reportBuilder *reports.Builder) bool
type Rule ¶
type Rule interface {
Apply(*expression.GomegaExpression, types.Config, *reports.Builder) bool
}
func GetMissingAssertionRule ¶
func GetMissingAssertionRule() Rule
type Rules ¶
type Rules []Rule
func GetAsyncRules ¶
func GetAsyncRules() Rules
func (Rules) Apply ¶
func (r Rules) Apply(gexp *expression.GomegaExpression, config types.Config, reportBuilder *reports.Builder) bool
type SucceedRule ¶ added in v0.18.0
type SucceedRule struct{}
func (SucceedRule) Apply ¶ added in v0.18.0
func (r SucceedRule) Apply(gexp *expression.GomegaExpression, config types.Config, reportBuilder *reports.Builder) bool
Source Files ¶
- asyncfunccallrule.go
- asyncsucceedrule.go
- asynctimeintervalsrule.go
- caprule.go
- comparepointerrule.go
- comparisonrule.go
- doublenegativerule.go
- equalboolrule.go
- equaldifferenttypesrule.go
- equalnilrule.go
- errorequalnilrule.go
- forceexpecttorule.go
- havelen0.go
- haveoccurredrule.go
- lenrule.go
- matcheronlyrule.go
- matcherrorrule.go
- missingassertionrule.go
- nilcomparerule.go
- rule.go
- succeedrule.go