         :ok
 
       {extra, stack} ->
+        doctest = "\n" <> formatted <> "\n" <> expected_expr
+        expr = "inspect(#{last_expr}) === #{String.trim(expected_expr)}"
         error = [doctest: doctest, expr: expr] ++ extra
         reraise ExUnit.AssertionError, error, stack ++ parent_stack
     end
   end
 
   @doc false
-  def __error__(fun, message, doctest, exception, stack) do
+  def __error__(fun, message, exception, formatted, stack) do
     try do
       fun.()
     rescue

    doctest = "\n" <> formatted <> "\n" <> expected
    expr_ast = string_to_quoted(location, stack, expr, doctest) |> insert_assertions()
    expected_ast = string_to_quoted(location, stack, expected, doctest)
    last_expr_ast = last_expr(expr_ast)

    quote do
      expected = unquote(expected_ast)
      doctest = unquote(doctest)
      expr = <<unquote(Macro.to_string(last_expr_ast)), " === ", unquote(String.trim(expected))>>
      stack = unquote(stack)

      ExUnit.DocTest.__test__(unquote(expr_ast), expected, doctest, expr, stack)
    end
  end


  end

  @doc false
  def __inspect__(value, expected, formatted, last_expr, expected_expr, parent_stack) do
    result =
      try do
        inspect(value, safe: false)
