File tree Expand file tree Collapse file tree 3 files changed +19
-3
lines changed Expand file tree Collapse file tree 3 files changed +19
-3
lines changed Original file line number Diff line number Diff line change 4
4
5
5
* Enhancements
6
6
* [ ExUnit] Print process mailbox on failing ` assert_receive `
7
+ * [ ExUnit] Tag all doctests with the ` :doctest ` tag
7
8
* [ Mix] ` mix deps.unlock ` warns when given missing dependency
8
9
* [ Kernel] Friendlier ` unquote_splicing ` error on inline quote
9
10
Original file line number Diff line number Diff line change @@ -152,6 +152,7 @@ defmodule ExUnit.DocTest do
152
152
tests = quote bind_quoted: binding do
153
153
file = "(for doctest at) " <> Path . relative_to_cwd ( mod . __info__ ( :compile ) [ :source ] )
154
154
for { name , test } <- ExUnit.DocTest . __doctests__ ( mod , opts ) do
155
+ @ tag :doctest
155
156
@ file file
156
157
test name , do: unquote ( test )
157
158
end
@@ -348,9 +349,9 @@ defmodule ExUnit.DocTest do
348
349
349
350
moduledocs = extract_from_moduledoc ( all_docs [ :moduledoc ] )
350
351
351
- docs = for doc <- all_docs [ :docs ] do
352
- extract_from_doc ( doc )
353
- end |> Enum . concat
352
+ docs = for doc <- all_docs [ :docs ] ,
353
+ doc <- extract_from_doc ( doc ) ,
354
+ do: doc
354
355
355
356
moduledocs ++ docs
356
357
end
Original file line number Diff line number Diff line change @@ -264,6 +264,20 @@ defmodule ExUnit.DocTestTest do
264
264
"""
265
265
end
266
266
267
+ test "tags tests as doctests" do
268
+ defmodule DoctestTag do
269
+ use ExUnit.Case
270
+ doctest ExUnit.DocTestTest.NoImport
271
+
272
+ setup test do
273
+ assert test . doctest
274
+ :ok
275
+ end
276
+ end
277
+
278
+ assert capture_io ( fn -> ExUnit . run end ) =~ "1 tests, 0 failures"
279
+ end
280
+
267
281
test "multiple exceptions in one test case is not supported" do
268
282
assert_raise ExUnit.DocTest.Error , ~r" multiple exceptions in one doctest case are not supported" , fn ->
269
283
defmodule NeverCompiled do
You can’t perform that action at this time.
0 commit comments