Template Macros, Initial Release
Template Macros are a new Racket library that dramatically simplifies the generation of meta-program code.
Template Macros are a new Racket library that dramatically simplifies the generation of meta-program code.
Generating rackunit tests with Racket macros is an easy way to improve the quality of your unit tests and your unit testing experience. Macros not only save you the time and energy of writing boilerplate, but also allow you to customize how tests are specified.
So what’s the catch?
rackunit’s basic checks are, by and large, functions. They raise run-time errors when they fail, and run-time errors report the source locations of their call sites. In tests generated by purely pattern-based macros, these locations point inside the macro definitions. Giving useful source locations to macro-generated tests takes a little more work.