MarkdownDoctest

Test Elixir code blocks directly from Markdown files, without iex> syntax.

# In test suite file
use MarkdownDoctest

markdown_doctest "README.md"

# Filter out the traditional `def deps` block
markdown_doctest "README.md", except: &(&1 =~ "def deps do")

Errors will be shown with a stacktrace pointing to the line that failed inside the markdown file.

Installation

The package can be installed by adding markdown_doctest to your list of dependencies in mix.exs:

# mix.exs
def deps do
  [
    {:markdown_doctest, "~> 0.2.0", only: :test, runtime: false}
  ]
end

# .formatter.exs
[
  import_deps: [:markdown_doctest]
]