Chapter 4How to Test Macros

Any good library is only as reliable as the test suite behind it. You’ve written your own language features and a couple of essential application libraries. You even saw how macros let you create an expressive test framework. What you haven’t seen yet is how to test macros themselves and the code generation they perform. We’re going explore how to test macros so you can confidently maintain your libraries. You’ll see few techniques for testing code generation and different test-case strategies for the types of metaprogramming involved.

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.