evnu
Docception - Run doctests for markdown files
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.
Most Liked
Qqwy
OvermindDL1
Ooo I’ve always wanted that to be done, always wished I could doctest an md file instead of an elixir file. ![]()
Popular in Announcing
Other popular topics
Categories:
Sub Categories:
Forums
Popular Tags
- #ecto
- #liveview
- #troubleshooting
- #learning-elixir
- #deployment
- #library
- #erlang
- #testing
- #genserver
- #mix
- #absinthe
- #remote-other
- #otp
- #plug
- #how-to-question
- #macros
- #postgres
- #channels
- #elixirconf
- #exunit
- #discussion
- #code-sync
- #javascript
- #podcasts
- #onsite
- #dialyzer
- #docker
- #authentication
- #umbrella
- #full-time-contract
- #podcasts-by-brainlid
- #ecto-query
- #elixir-ls
- #phoenix_html
- #iex
- #blog-post
- #graphql
- #genstage
- #ai
- #websockets
- #supervisor
- #elixirconf-us
- #advent-of-code
- #distillery
- #processes
- #api
- #forms
- #metaprogramming
- #security
- #hex









