Checks a probe until the timeout expires. The assert error is produced if the probe fails to return 'true' before the timeout.
The parameter timeout determines the maximum timeout to wait before asserting a failure (default is 500ms).
The parameter delay determines how often the predicate will be checked (default is 10ms).
This kind of assertion is very useful to check on code that runs in another thread. For instance, the thread that listens to a socket.
AssertException when the probe fails to become true before timeout
1 assertEventually({ static count = 0; return ++count > 23; }); 2 3 auto exception = expectThrows!AssertException(assertEventually({ return false; })); 4 5 assertEquals("timed out", exception.msg);
See Implementation
Checks a probe until the timeout expires. The assert error is produced if the probe fails to return 'true' before the timeout.
The parameter timeout determines the maximum timeout to wait before asserting a failure (default is 500ms).
The parameter delay determines how often the predicate will be checked (default is 10ms).
This kind of assertion is very useful to check on code that runs in another thread. For instance, the thread that listens to a socket.