Unit Tests

Learn about unit-testing macros using the Translator module as an example.

We'll cover the following

We should use unit-testing macros only for cases where we need to test a tricky code generation in isolation. Over-testing macros at the unit level can lead to brittle tests because we can only test the AST generated from the macro or the string of source produced. These values can be hard to match against and are subject to change, leading to error-prone tests that are difficult to maintain.

Get hands-on with 1200+ tech skills courses.