toEventually will continuously call (and wait for) the expression passed in to evaluate, it's just now compatible with async expressions. It does kick off a new task each time it polls. This is due to the fact that toEventually uses dispatch queues under the hood, and dispatch queues are always synchronous contexts. If the expression you're verifying needs to run on the main thread, you'll likely have to force it to do so. Either by marking the test itself as running on the main thread, or by marking the expression as running on the main thread, like so:
Predicates are unchanged. This implementation converts the async expression to a synchronous expression as part of the to/toNot/toEventually ... call. This does mean that a large amount of operator overloads are now duplicated, because we need to do the awaiting as part of the operator, and this change does break operator overloads for anyone else using this.
expecta
to allow autoclosures with async expressions.expects
to allow you to force synchronous expectations in Nimble.Changes to the readme also documents this.
basically, this now allows the following code:
toEventually
will continuously call (and wait for) the expression passed in to evaluate, it's just now compatible with async expressions. It does kick off a new task each time it polls. This is due to the fact that toEventually uses dispatch queues under the hood, and dispatch queues are always synchronous contexts. If the expression you're verifying needs to run on the main thread, you'll likely have to force it to do so. Either by marking the test itself as running on the main thread, or by marking the expression as running on the main thread, like so:Predicates are unchanged. This implementation converts the async expression to a synchronous expression as part of the
to
/toNot
/toEventually
... call. This does mean that a large amount of operator overloads are now duplicated, because we need to do the awaiting as part of the operator, and this change does break operator overloads for anyone else using this.