On Fri, May 12, 2017 at 05:23:23PM -0400, Steven Schveighoffer via Digitalmars-d-learn wrote: [...] > Note, you can achieve what you want with version(unittest): > > version(unittest) > { > class A { B b; } > class B { } > } > > unittest > { > // use A and B here > } [...]
This advice, unfortunately, needs to be tempered with caution about namespace pollution and accidental dependency of things outside unittests on things inside a version(unittest) block. There's also the issue of library code introducing extraneous import dependencies that are really only necessary for unittesting, but get pulled in anyway because user code happens to compile with -unittest. T -- "Real programmers can write assembly code in any language. :-)" -- Larry Wall