Further Exploration

We journeyed from simple control flow transformations all the way through a mini testing framework. Along the way, you learned all the tools necessary to define your own macros and perform AST transformations in a responsible way. Next, we’ll discover a few advanced compile-time code-generation techniques to create highly performant and maintainable programs.

On your own, explore ways you can enhance your Assertion test framework and define new macro constructs. Here are a few basic experiments to get you started:

  • Implement assert for every operator in Elixir.

  • Add Boolean assertions, such as assert true.

  • Implement a refute macro for refutations.

And some that are more advanced:

  • Run test cases in parallel within Assertion.Test.run/2 ...

Get Metaprogramming Elixir now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.