On Tuesday, 29 October 2019 at 08:45:15 UTC, mipri wrote:
[snip]

-unittest sets the 'unittest' version identifier. So this works:

  unittest {
     assert(0);
  }

  version(unittest) {
      extern(C) void main() {
static foreach(u; __traits(getUnitTests, __traits(parent, main)))
              u();
      }
  }

dmd -betterC -unittest -run module.d

I feel like this should be added into the compiler so that it just works.

Reply via email to