LLReactiveMatchers icon indicating copy to clipboard operation
LLReactiveMatchers copied to clipboard

Semantics for Completion & Error testing Asynchronously

Open lawrencelomax opened this issue 11 years ago • 2 comments

The behaviour of asynchronous matching is to continuously check the matcher passes until the timeout elapses, or the matcher passes.

This can pose a problem for negative matchers, which essentially invert the matcher.

Given an asynchronous signal that will complete before the timeout period, but after the matcher is first polled, it will pass because the condition that completed is not sent will be satisfied immediately be passed. The desired behaviour would be to check that the condition is satisfied for the duration of the timeout period.

// Lets assume that this signal does not exhibit the desired behaviour of not completing
// It will complete a short time after it is subscribed to
RACSignal *signal;
// Passes immediately
expect(signal).toNot.complete();

This knowledge about the expectation would probably need to be implemented in something like EXPExpect

lawrencelomax avatar Dec 14 '13 05:12 lawrencelomax

This is heavily related to expecta #48

lawrencelomax avatar Dec 31 '13 03:12 lawrencelomax

Thinking about it, the contract of EXPExpect's will matcher makes sense. 'Will' implies that a certain condition will be met at some point in the future. This 'point in the future' could be immediately.

The solution has to be a way of hooking into EXPExpect's matching behaviour. It seems that this could be done in a generic way such that a number of matching behaviours could be implemented, passing through information about when the matcher is applied.

Names: willAlways, willContinueTo, willMatchContinuouslyWith

lawrencelomax avatar Dec 31 '13 04:12 lawrencelomax