Skip to content

Commit 0a7f6e7

Browse files
author
José Valim
committed
Merge pull request #1725 from alco/assert_receive
Add a tricky pattern example for assert_receive
2 parents 8bd43ed + 3523791 commit 0a7f6e7

File tree

1 file changed

+8
-5
lines changed

1 file changed

+8
-5
lines changed

lib/ex_unit/lib/ex_unit/assertions.ex

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -247,9 +247,9 @@ defmodule ExUnit.Assertions do
247247

248248
@doc """
249249
Asserts a message was or is going to be received. Unlike
250-
`assert_received`, it has a default timeout of 100 miliseconds.
250+
`assert_received`, it has a default timeout of 100 milliseconds.
251251
252-
The given `expected` argument must be a pattern.
252+
The given `expected` argument has to be a pattern.
253253
254254
## Examples
255255
@@ -263,17 +263,20 @@ defmodule ExUnit.Assertions do
263263
264264
assert_receive { :hello, _ }
265265
266+
x = 5
267+
assert_receive { :count, ^x }
268+
266269
"""
267270
defmacro assert_receive(expected, timeout // 100, message // nil) do
268271
do_assert_receive(expected, timeout, message)
269272
end
270273

271274
@doc """
272-
Asserts a message was received and is in the current process mailbox.
273-
The given `expected` argument must be a match pattern.
274-
275+
Asserts a message was received and is in the current process' mailbox.
275276
Timeout is set to 0, so there is no waiting time.
276277
278+
The given `expected` argument has to be a pattern.
279+
277280
## Examples
278281
279282
self <- :hello

0 commit comments

Comments
 (0)