Hi!
I spent some hours the last few days to put together a simple helper to check that code examples in README.md files can actually be tested against the project. The result is Docception, which exposes a mix task to check any markdown file using Elixir’s own doctest
:
$ mix docception README.md # run the doctests in README.md
The approach of Docception is simply: It reads a file, generates an abstract Erlang Form for the Docs
chunk, and puts that into the very-private-do-not-trust-I-will-be-there-later ExUnit.DocTest.__doctests__/1
function. See the repository for some more information and an example project using the mix task within an alias for mix test
.
I hope somebody finds that useful, or at least interesting.