   end
 
   test "consolidation prevents new implementations" do
-    assert ExUnit.CaptureIO.capture_io(:stderr, fn ->
-      defimpl WithAny, for: Integer do
-        def ok(_any), do: :ok
-      end
-    end) =~ ~r"the .+WithAny protocol has already been consolidated"
+    output =
+      ExUnit.CaptureIO.capture_io(:stderr, fn ->
+        defimpl WithAny, for: Integer do
+          def ok(_any), do: :ok
+        end
+      end)
+
+    assert output =~ ~r"the .+WithAny protocol has already been consolidated"
   after
     :code.purge(WithAny.Atom)
     :code.delete(WithAny.Atom)
   end
 
   test "consolidated implementations without any" do
-    assert is_nil Sample.impl_for(:foo)
-    assert is_nil Sample.impl_for(fn(x) -> x end)
-    assert is_nil Sample.impl_for(1)
-    assert is_nil Sample.impl_for(1.1)
-    assert is_nil Sample.impl_for([])
-    assert is_nil Sample.impl_for([1, 2, 3])
-    assert is_nil Sample.impl_for({})
-    assert is_nil Sample.impl_for({1, 2, 3})
-    assert is_nil Sample.impl_for("foo")
-    assert is_nil Sample.impl_for(<<1>>)
-    assert is_nil Sample.impl_for(self())
-    assert is_nil Sample.impl_for(%{})
-    assert is_nil Sample.impl_for(hd(:erlang.ports))
-    assert is_nil Sample.impl_for(make_ref())
-
-    assert Sample.impl_for(%ImplStruct{}) ==
-           Sample.Protocol.ConsolidationTest.ImplStruct
-    assert Sample.impl_for(%NoImplStruct{}) ==
-           nil
+    assert is_nil(Sample.impl_for(:foo))
+    assert is_nil(Sample.impl_for(fn x -> x end))
+    assert is_nil(Sample.impl_for(1))
+    assert is_nil(Sample.impl_for(1.1))
+    assert is_nil(Sample.impl_for([]))
+    assert is_nil(Sample.impl_for([1, 2, 3]))
+    assert is_nil(Sample.impl_for({}))
+    assert is_nil(Sample.impl_for({1, 2, 3}))
+    assert is_nil(Sample.impl_for("foo"))
+    assert is_nil(Sample.impl_for(<<1>>))
+    assert is_nil(Sample.impl_for(self()))
+    assert is_nil(Sample.impl_for(%{}))
+    assert is_nil(Sample.impl_for(hd(:erlang.ports())))
+    assert is_nil(Sample.impl_for(make_ref()))
+
+    assert Sample.impl_for(%ImplStruct{}) == Sample.Protocol.ConsolidationTest.ImplStruct
+    assert Sample.impl_for(%NoImplStruct{}) == nil
   end
 
   test "consolidated implementations with any and tuple fallback" do
     assert WithAny.impl_for(%NoImplStruct{}) == WithAny.Any
-    assert WithAny.impl_for(%ImplStruct{}) == WithAny.Any # Derived
+    # Derived
+    assert WithAny.impl_for(%ImplStruct{}) == WithAny.Any
     assert WithAny.impl_for(%{__struct__: "foo"}) == WithAny.Map
     assert WithAny.impl_for(%{}) == WithAny.Map
     assert WithAny.impl_for(self()) == WithAny.Any

Code.require_file "test_helper.exs", __DIR__

defmodule ProtocolTest do
  use ExUnit.Case, async: true

  test "protocol documentation" do
    import PathHelpers

    write_beam(
      defprotocol SampleDocsProto do
        @type t :: any
        @doc "Ok"
        @spec ok(t) :: boolean
        def ok(term)
      end
    )

    docs = Code.get_docs(SampleDocsProto, :docs)
    assert {{:ok, 1}, _, :def, [{:term, _, nil}], "Ok"} = List.keyfind(docs, {:ok, 1}, 0)
  end

  test "protocol keeps underlying UndefinedFunctionError" do
