Currently D compilers don't allow passing -version=unittest
flag explicitly, requiring to pass -unittest
instead. But -unittest
has a additional meaning: it will compile UTs as well!
So, if I have two modules A.d
and B.d
, both define some UTs, B
imports A
and A
has some version(unittest)
blocks in non-templated code, there is no way to build just UTs from B
.
I can build B
using dmd -c -unittest B.d
, but there is no way to build A
correctly:
- if I build it without
-unittest
, conditional compilation forversion(unittest)
blocks won't trigger; - and if I build it with
-unittest
, I get also UTs fromA
.
It's a simplified example, instead of two modules in reality it's a dependency chain of groups of modules, where each group is compiled in one step, but we still want to get separate UTs for every group, instead of getting everything in the root group.
I get it, in D world people are usually compiling everything in one shot, so that's not a problem. But unfortunately this approach doesn't scale very well.
How bad it will be to stop failing on -version=unittest
? Seems like compiling UTs dependencies is a valid use case for it.