Skip to content

Commit 1ae24c5

Browse files
author
José Valim
committed
Update CHANGELOG
1 parent 6c02ebe commit 1ae24c5

File tree

4 files changed

+27
-14
lines changed

4 files changed

+27
-14
lines changed

CHANGELOG.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,16 @@
33
## v1.0.0-rc2
44

55
* Enhancements
6+
* [ExUnit] Print process mailbox on failing `assert_receive`
7+
* [Mix] `mix deps.unlock` warns when given missing dependency
8+
* [Kernel] Friendlier `unquote_splicing` error on inline quote
69

710
* Bug fixes
11+
* [Logger] Fix `Logger.log/2` not to raise on Logger exit
12+
* [Logger] Recompute sync/async mode on Logger configuration
13+
14+
* Backwards incompatible changes
15+
* [Supervisor] Make `max_restarts` default to 3 (closer to upcoming Erlang defaults)
816

917
## v1.0.0-rc1 (2014-08-30)
1018

lib/elixir/test/elixir/supervisor/spec_test.exs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ defmodule Supervisor.SpecTest do
6464

6565
test "supervise/2" do
6666
assert supervise([], strategy: :one_for_one) == {
67-
:ok, {{:one_for_one, 5, 5}, []}
67+
:ok, {{:one_for_one, 3, 5}, []}
6868
}
6969

7070
children = [worker(GenEvent, [])]

lib/ex_unit/lib/ex_unit/assertions.ex

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -281,7 +281,7 @@ defmodule ExUnit.Assertions do
281281
unquote(expected) = received -> received
282282
after
283283
unquote(timeout) ->
284-
flunk(unquote(message) <> mailbox(self))
284+
flunk(unquote(message) <> ExUnit.Assertions.__mailbox__(self()))
285285
end
286286
end
287287

@@ -291,19 +291,21 @@ defmodule ExUnit.Assertions do
291291
@max_mailbox_length 10
292292

293293
@doc false
294-
def mailbox(pid) do
294+
def __mailbox__(pid) do
295295
{:messages, messages} = Process.info(pid, :messages)
296296
length = length(messages)
297-
mailbox = Enum.take(messages, @max_mailbox_length)
298-
|> Enum.map_join("\n", &inspect/1)
299-
". Process mailbox (#{length}):" <> mailbox_message(length, mailbox)
297+
mailbox = Enum.take(messages, @max_mailbox_length) |> Enum.map_join("\n", &inspect/1)
298+
mailbox_message(length, mailbox)
300299
end
301300

302-
defp mailbox_message(0, _mailbox), do: " []"
301+
defp mailbox_message(0, _mailbox), do: ". The process mailbox is empty."
303302
defp mailbox_message(length, mailbox) when length > 10 do
304-
"\n" <> mailbox <> "\nShowing only #{@max_mailbox_length} first messages."
303+
". Process mailbox:\n" <> mailbox
304+
<> "\nShowing only #{@max_mailbox_length} of #{length} messages."
305+
end
306+
defp mailbox_message(_length, mailbox) do
307+
". Process mailbox:\n" <> mailbox
305308
end
306-
defp mailbox_message(_length, mailbox), do: "\n" <> mailbox
307309

308310
@doc """
309311
Asserts the `exception` is raised during `function` execution with

lib/ex_unit/test/ex_unit/assertions_test.exs

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -91,27 +91,30 @@ defmodule ExUnit.AssertionsTest do
9191
"This should never be tested" = assert_received :hello
9292
rescue
9393
error in [ExUnit.AssertionError] ->
94-
"No message matching :hello. Process mailbox (0): []" = error.message
94+
"No message matching :hello. The process mailbox is empty." = error.message
9595
end
9696
end
9797

9898
test "assert received when different message" do
9999
send self, {:message, :not_expected, :at_all}
100100
try do
101-
"This should never be tested" = assert_receive :hello, 5_000
101+
"This should never be tested" = assert_received :hello
102102
rescue
103103
error in [ExUnit.AssertionError] ->
104-
"No message matching :hello. Process mailbox (1):\n{:message, :not_expected, :at_all}" = error.message
104+
"No message matching :hello. Process mailbox:\n{:message, :not_expected, :at_all}" = error.message
105105
end
106106
end
107107

108108
test "assert received when different message having more than 10 on mailbox" do
109109
for i <- 1..11, do: send(self, {:message, i})
110110
try do
111-
"This should never be tested" = assert_receive :hello, 5_000
111+
"This should never be tested" = assert_received :hello
112112
rescue
113113
error in [ExUnit.AssertionError] ->
114-
"No message matching :hello. Process mailbox (11):\n{:message, 1}\n{:message, 2}\n{:message, 3}\n{:message, 4}\n{:message, 5}\n{:message, 6}\n{:message, 7}\n{:message, 8}\n{:message, 9}\n{:message, 10}\nShowing only 10 first messages." = error.message
114+
"No message matching :hello. Process mailbox:\n" <>
115+
"{:message, 1}\n{:message, 2}\n{:message, 3}\n{:message, 4}\n" <>
116+
"{:message, 5}\n{:message, 6}\n{:message, 7}\n{:message, 8}\n" <>
117+
"{:message, 9}\n{:message, 10}\nShowing only 10 of 11 messages." = error.message
115118
end
116119
end
117120

0 commit comments

Comments
 (0)