Don’t Test Generated Code
Note that generated code also falls into this category. The benefits of generating source code have proven themselves for decades. Early compilers were assembly code generators. Many compilers are generated from descriptions of their lexemes and grammars. XML parsers, regular expression generators, and CORBA, SOAP, and REST interfaces all use code generation in many implementations. Trends toward domain-specific languages (DSLs) and higher-level constructs frequently employ generators, at least in their early incarnations. So why wouldn’t we test that code?
First of all, code generation usually derives from a solid theoretical or experiential foundation. The generators implement empirically or algorithmically correct ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access