O'Reilly logo

Metaprogramming Elixir by Chris McCord

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Integration Testing

We did some advanced metaprogramming with our Mime and Translator libraries in Chapter 3, Advanced Compile-Time Code Generation. Macro-driven libraries that generate large amounts of code are best tested at the integration level. Next, you’ll find out what integration testing is all about and how we can apply it to the libraries we’ve written.

Test Your Generated Code, Not Your Code Generation

Integration testing means we test our library behavior at the top level. Given an input, we expect an output. We aren’t so much concerned with testing the individual subcomponents. Testing macro-generated code in this way is effective because it’s very difficult to isolate the AST transformation steps along the way. Instead, we use ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required