On Friday, 7 June 2019 at 16:41:12 UTC, Adam D. Ruppe wrote:
On Friday, 7 June 2019 at 16:33:13 UTC, Machine Code wrote:
All this effort is because I do not want unittest code in a
release or even debug.
Well, that part is easy:
version(unittest)
struct Foo {}
at any scope is only build when unittests are turned on in this
build.
Thank you! I was about to read version docs to see if I could
determine if I was in unittest by versioning. That's exact
behavior I was trying to acomplish.
I ended up doing this:
version(unittest)
{
struct Foo { }
shared static this() {
// test code ...
}
}
Act like a unittest {} but I can use CTFE stuff nicely.
Thank you all guys.