Skip to content

Commit 41b0ae4

Browse files
committed
Add a couple of comments explaining decisions
1 parent 4d793f6 commit 41b0ae4

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

lib/ex_unit/lib/ex_unit/doc_test.ex

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -197,6 +197,8 @@ defmodule ExUnit.DocTest do
197197
e in [ExUnit.ExpectationError] ->
198198
raise e, [], unquote(stack)
199199

200+
# If there was no exception among the tests, `exception` here will be
201+
# nil and this clause won't match.
200202
error in [unquote(exception)] ->
201203
unless error.message == unquote(message) do
202204
raise ExUnit.ExpectationError,
@@ -213,6 +215,9 @@ defmodule ExUnit.DocTest do
213215
[ prelude: "Expected doctest",
214216
description: unquote(whole_expr),
215217
expected: "#{inspect unquote(exception)}",
218+
# We're using a combined message here because all expressions
219+
# (those that are expected to raise and those that aren't) are in
220+
# the same try block above.
216221
reason: "complete or raise",
217222
actual: inspect(error) ],
218223
unquote(stack)

0 commit comments

Comments
 (0)