Exit before second main with -funittest
Brian Tiffin
btiffin at gnu.org
Fri Jul 30 01:01:02 UTC 2021
Is this good, bad or indifferent (a right left choice, first one
doesn't matter)?
```d
module cpuiding;
/+ imports +/
import std.stdio: writeln;
import core.cpuid;
/++ start here +/
void main(string[] args) {
writeln(args);
writeln(processor());
writeln(vendor());
}
/++ Self Test Once Only main +/
unittest {
import core.stdc.stdlib: _Exit;
main(["Hello, world"]);
_Exit(1);
}
```
Dumb? Breaks things in weird ways? Do what you want locally,
it's a preference for what you may want to do some times? I'm
finding it avoids a fair amount of clutter when testing main arg
handling, but too new to know if it's against the grain of intent.
Cheers
More information about the Digitalmars-d-learn
mailing list