Skip to content

@contract between @doc and def inhibits ExDoc, ExUnit.DocTest #80

@garthk

Description

@garthk

a_contract_between_doc_and_def/0 below won't get tested or documented, without any warning to that effect:

defmodule NormContractVsDoctest do
  @moduledoc """
  Demonstrates interaction between `@contract` and `@doc`
  """

  use Norm

  @doc """
  Return `:a`.

      iex> a_bare()
      :a
  """
  def a_bare, do: :a

  @doc """
  Return `:a`.

      iex> a_contract_between_doc_and_def()
      :a
  """
  @contract a_contract_between_doc_and_def() :: :a
  def a_contract_between_doc_and_def, do: :a

  @contract a_contract_before_doc() :: :a
  @doc """
  Return `:a`.

      iex> a_contract_before_doc()
      :a
  """
  def a_contract_before_doc, do: :a
end

Strikes me the suppression might not be fixable without help from both, but you might well be in a position to see the @doc above @contract and give warning. Failing that, let me know and I'll raise a PR to document the problem so people don't have to find it in the issues.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions