Documentation ¶
Index ¶
- func Attach(tr *erltest.TestReceiver, e erltest.Expectation) erltest.Expectation
- func Fail(ea erltest.ExpectArg, reason string) *erltest.ExpectationFailure
- type ExpectOpt
- type Expectation
- func AttachDeepEqual(tr *erltest.TestReceiver, expected any, cmpOpts []cmp.Option, ...) *Expectation
- func AttachEquals(tr *erltest.TestReceiver, expected any, opts ...ExpectOpt) *Expectation
- func Called(opts ...ExpectOpt) *Expectation
- func DeepEqual(t *testing.T, expected any, cmpOpts []cmp.Option, opts ...ExpectOpt) *Expectation
- func Equals(t *testing.T, expected any, opts ...ExpectOpt) *Expectation
- func NewExpectation(te Handle, opts ...ExpectOpt) *Expectation
- func Simple(f func(arg erltest.ExpectArg) bool, opts ...ExpectOpt) *Expectation
- type Handle
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Attach ¶
func Attach(tr *erltest.TestReceiver, e erltest.Expectation) erltest.Expectation
Attach an expectation to a receiver. If the expectation is not satisfied, the receiver will not Pass.
Types ¶
type ExpectOpt ¶
type ExpectOpt func(o expectOpts) expectOpts
func AnyTimes ¶
func AnyTimes() ExpectOpt
Expectation is satisifed if it is executed zero or more times. Ensure that you are sleeping the test or have other expectations so [TestReciever.Wait] does not exit immediately
func AtMost ¶
Expectation is satisifed if it is executed up to [n] times. Zero executions will also pass WARNING: this expectation will cause your test to run until [WaitTimeout] is exceeded
func Never ¶
func Never() ExpectOpt
expectation will pass only if never matched. Alias for `Times(0)` WARNING: this expectation will cause your test to run until [WaitTimeout] is exceeded
type Expectation ¶
type Expectation struct {
// contains filtered or unexported fields
}
func AttachDeepEqual ¶
func AttachDeepEqual(tr *erltest.TestReceiver, expected any, cmpOpts []cmp.Option, opts ...ExpectOpt) *Expectation
func AttachEquals ¶
func AttachEquals(tr *erltest.TestReceiver, expected any, opts ...ExpectOpt) *Expectation
Create an Equals expectation and attach it to [tr]
func Called ¶
func Called(opts ...ExpectOpt) *Expectation
Set an expectation that will pass if it is matched (or not matched, depending on opts). Useful if we don't care about a message's contents
func Equals ¶
func Equals(t *testing.T, expected any, opts ...ExpectOpt) *Expectation
assert a message equals exactly
func NewExpectation ¶
func NewExpectation(te Handle, opts ...ExpectOpt) *Expectation
func Simple ¶
func Simple(f func(arg erltest.ExpectArg) bool, opts ...ExpectOpt) *Expectation
Simple, terminal expectation that works well with check.Chain
func (*Expectation) Check ¶
func (ex *Expectation) Check(arg erltest.ExpectArg) (next erltest.Expectation, failure *erltest.ExpectationFailure)
[Check] should be executed after a "match" has been made to the expectation. It will return an error if it has been clearly executed too many times. If you want to evaluate if an Expectation has "passed", you should call [Satisified].
func (*Expectation) ID ¶
func (ex *Expectation) ID() string
func (*Expectation) Satisfied ¶
func (ex *Expectation) Satisfied(testEnded bool) bool
Returns the result of the expectation. If [testEnded] is true, checks that should never be executed (ie: Times(0)) will be evaluated.
func (*Expectation) String ¶
func (ex *Expectation) String() string
type Handle ¶
type Handle func(erltest.ExpectArg) (erltest.Expectation, *erltest.ExpectationFailure)