How can one reliably run unittests

Dennis dkorpel at gmail.com
Tue Aug 31 18:09:26 UTC 2021


On Tuesday, 31 August 2021 at 17:37:34 UTC, deadalnix wrote:
> Why is that? couldn't dmd -i simply not compile the module that 
> are "autoloaded" rather than explicitly provided without 
> unittests?

It could, but then `dmd -i -betterC -unittest -run testrunner.d` 
would not work anymore, where testrunner.d looks like:

```D
module testrunner;

static {
	import moda;
	import modb;
	import modc;
}

alias Seq(T...) = T;

extern(C) int main(int argc, const(char)** argv) {
	foreach(mod; Seq!(moda, modb, modc)) {
		static foreach (test; __traits(getUnitTests, mod)) {
			test();
		}
	}
	return 0;
}
```


More information about the Digitalmars-d mailing list