Skip to content

Commit 2075a9b

Browse files
committed
Minor formatting fixes
1 parent abb2614 commit 2075a9b

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed

lib/ex_unit/lib/ex_unit/doc_test.ex

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -52,12 +52,12 @@ defmodule ExUnit.DocTest do
5252
2
5353
5454
If you want to keep any two tests separate from each other,
55-
add an empty line between them:
55+
add an empty line between them (assume > to stand for iex> here):
5656
57-
iex> a = 1
57+
> a = 1
5858
1
5959
60-
iex> a + 1 # will fail with a "function a/0 undefined" error
60+
> a + 1 # will fail with a "function a/0 undefined" error
6161
2
6262
6363
Similarly to iex you can use numbers in your "prompts":
@@ -189,6 +189,8 @@ defmodule ExUnit.DocTest do
189189
{ tests, whole_expr } = Enum.map_reduce exprs, "", fn {expr, expected}, acc ->
190190
{ test_case_content(expr, expected, module, line, file, stack), acc <> expr <> "\n" }
191191
end
192+
whole_expr = String.strip(whole_expr)
193+
192194
{ exception, message } = case Enum.find(exprs, exc_filter_fn) do
193195
{ _, {:error, exception, message} } ->
194196
{ exception, message }
@@ -288,7 +290,7 @@ defmodule ExUnit.DocTest do
288290
quote do
289291
raise ExUnit.ExpectationError,
290292
[ prelude: "Expected doctest",
291-
description: unquote(expr),
293+
description: unquote(String.strip(expr)),
292294
expected: "successfully",
293295
reason: "compile",
294296
actual: unquote("** #{inspect e.__record__(:name)} #{e.message}") ],

0 commit comments

Comments
 (0)