diff --git a/lib/elixir/lib/kernel/special_forms.ex b/lib/elixir/lib/kernel/special_forms.ex index b3e32c7dd5c..384a087c32d 100644 --- a/lib/elixir/lib/kernel/special_forms.ex +++ b/lib/elixir/lib/kernel/special_forms.ex @@ -2355,7 +2355,7 @@ defmodule Kernel.SpecialForms do defmacro try(args), do: error!([args]) @doc """ - Checks if there is a message matching any of the given clauses in the current + Consumes the first message matching any of the given clauses in the current process mailbox. If there is no matching message, the current process waits until a matching diff --git a/lib/ex_unit/lib/ex_unit/assertions.ex b/lib/ex_unit/lib/ex_unit/assertions.ex index 00ba6ed942a..6440bba076a 100644 --- a/lib/ex_unit/lib/ex_unit/assertions.ex +++ b/lib/ex_unit/lib/ex_unit/assertions.ex @@ -459,8 +459,10 @@ defmodule ExUnit.Assertions do The default timeout duration is determined by the `assert_receive_timeout` option, which can be set using `ExUnit.configure/1`. This option defaults to 100 milliseconds. - The `pattern` argument must be a match pattern. Flunks with `failure_message` - if a message matching `pattern` is not received. + The `pattern` argument must be a match pattern. + + Flunks with `failure_message` if a message matching `pattern` is not received. + If a message matches, it is also removed from the process mailbox. ## Examples @@ -487,8 +489,10 @@ defmodule ExUnit.Assertions do Asserts that a message matching `pattern` was received and is in the current process' mailbox. - The `pattern` argument must be a match pattern. Flunks with `failure_message` - if a message matching `pattern` was not received. + The `pattern` argument must be a match pattern. + + Flunks with `failure_message` if a message matching `pattern` was not received. + If a message matches, it is also removed from the process mailbox. Timeout is set to `0`, so there is no waiting time.