     moduledocs ++ docs
   end
 
-  defp extract_from_moduledoc({_, negative}) when negative in [false, nil], do: []
+  defp extract_from_moduledoc({_, doc}) when doc in [false, nil], do: []
 
   defp extract_from_moduledoc({line, doc}) do
     extract_tests(line, doc)
   end
 
-  defp extract_from_doc({_, _, _, _, negative}) when negative in [false, nil], do: []
+  defp extract_from_doc({_, _, _, _, doc}) when doc in [false, nil], do: []
 
   defp extract_from_doc({ fa, line, _, _, doc}) do
     lc test inlist extract_tests(line, doc) do


  @doc false
  def __doctests__(module, opts) do
    only   = opts[:only] || []
    except = opts[:except] || []
    do_import = Keyword.get(opts, :import, false)

    tests = Enum.filter(extract(module), fn(test) ->
      fa = test.fun_arity
      Enum.all?(except, &(&1 != fa)) and Enum.all?(only, &(&1 == fa))
    end)

    Enum.map_reduce(tests, 1, fn(test, acc) ->
      { compile_test(test, module, do_import, acc), acc + 1 }
    end) |> elem(0)
  end

  ## Compilation of extracted tests

    location = [line: line, file: Path.relative_to_cwd(file)]
    stack    = Macro.escape [{ module, :__MODULE__, 0, location }]

    if multiple_exceptions?(exprs) do
      { fun, arity } = fun_arity
      raise Error, message: "multiple exceptions in one doctest case are not supported. "
                            "Invalid doctest for #{inspect module}.#{fun}/#{arity}"
    end

    tests = Enum.map exprs, fn { expr, expected } ->
      test_case_content(expr, expected, module, line, file, stack)
    end

    quote do
      unquote_splicing(test_import(module, do_import))
      unquote(gen_code_for_tests(tests, whole_expr(exprs), exception_expr(exprs), stack))
    end
  end

  defp whole_expr(exprs) do
    Enum.map_join(exprs, "\n", &elem(&1, 0))
  end

  defp exception_expr(exprs) do
    Enum.find_value(exprs, "nothing", fn
      { _, {:error, exception, message} } ->
        inspect(exception) <> " with message " <> message
      _ ->
        nil
    end)
  end

  defp multiple_exceptions?(exprs) do
    Enum.count(exprs, fn
      { _, {:error, _, _} } -> true
      _ -> false
    end) > 1
  end

  defp gen_code_for_tests(tests, whole_expr, exception, stack) do
