13 use ExUnit.Case, async: true # for async
24 import ExUnit.CaptureIO
27 result = capture_io(fn ->
31 assert result == "sup\n"
38 config :ex_unit, capture_logs: true
44 defmodule AssertionTest do
45 # run concurrently with other test cases
46 use ExUnit.Case, async: true
56 assert_raise ArithmeticError, fn ->
60 assert_raise ArithmeticError, "message", fn -> ...
61 assert_raise ArithmeticError, ~r/message/, fn -> ...
63 flunk "This should've been an error"
66 See: [Assertions](http://devdocs.io/elixir/ex_unit/exunit.assertions)
79 test "it works", %{name: name} do
88 defp my_hook(_context) do
89 # Invoked in every block in "a block"
90 {:ok, name: "John", age: 54}
96 test "John's age", context do
97 assert context[:name] == "John"
98 assert context[:age] == 54
107 * [ExUnit Docs](http://devdocs.io/elixir/ex_unit/exunit#configure/1)