diff options
author | Serge Aleynikov <[email protected]> | 2015-02-14 17:19:17 -0500 |
---|---|---|
committer | Zandra Hird <[email protected]> | 2015-05-18 14:27:56 +0200 |
commit | e56cf8d9846e51ae88fa72c8b0992d81da6fd7d5 (patch) | |
tree | 8ffa549565dc37ba5c1c3685b92904dfd19d78a3 /lib/eunit/doc/overview.edoc | |
parent | bcc5248a76ee692ede18367a1f3d6cd9acd6cde7 (diff) | |
download | otp-e56cf8d9846e51ae88fa72c8b0992d81da6fd7d5.tar.gz otp-e56cf8d9846e51ae88fa72c8b0992d81da6fd7d5.tar.bz2 otp-e56cf8d9846e51ae88fa72c8b0992d81da6fd7d5.zip |
Add ?assertReceive(Guard, Timeout) macro to eunit
A convenience macro used for testing message passing logic by allowing
to fail if a message matching a `Guard` is not received in the mailbox
of the current process.
Diffstat (limited to 'lib/eunit/doc/overview.edoc')
-rw-r--r-- | lib/eunit/doc/overview.edoc | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/lib/eunit/doc/overview.edoc b/lib/eunit/doc/overview.edoc index df716cdeea..eb60f673ef 100644 --- a/lib/eunit/doc/overview.edoc +++ b/lib/eunit/doc/overview.edoc @@ -572,6 +572,21 @@ Examples: <dt>`assertNotMatch(GuardedPattern, Expr)'</dt> <dd>The inverse case of assertMatch, for convenience. </dd> +<dt>`assertReceive(GuardedPattern, Timeout)'</dt> +<dd>Waits for up to the `Timeout' milliseconds for a message to arrive +in the mailbox of the current process that matches against the +`GuardedPattern' if testing is enabled. +If no message matching the `GuardedPattern' is received in the specified +`Timeout' interval, the assertion fails and an informative exception will +be generated; see the `assert' macro for further details. `GuardedPattern' +can be anything that you can write on the left hand side of the `->' +symbol in a case-clause, except that it cannot contain comma-separated +guard tests. + +Examples: +```?assertReceive(done, 1000)''' +```?assertReceive(Bin when byte_size(Bin) > 10, 1000)''' +</dd> <dt>`assertEqual(Expect, Expr)'</dt> <dd>Evaluates the expressions `Expect' and `Expr' and compares the results for equality, if testing is enabled. If the values are not |