Can we get unitests to not run with program start ?

deadalnix via Digitalmars-d digitalmars-d at puremagic.com
Tue Oct 25 23:06:36 PDT 2016


On Wednesday, 26 October 2016 at 05:32:51 UTC, Jonathan M Davis 
wrote:
> That being said, using -main when unit testing libraries and 
> declaring main in applications to look something like
>
> version(unittest) void main() {}
> else int main(string[] args) {...}
>
> doesn't seem like all that big a deal to me. Not ideal, but not 
> a big deal.
>

It is. once you need to put that in the file, there is a ton of 
automation that can't happen anymore.

Also, to anyone outside this forum, it feels like this: 
https://www.youtube.com/watch?v=szdbKz5CyhA

> Regardless, I really don't think that it ever makes sense to 
> actually run main after running the unit tests. So, in that 
> sense, what dmd does with -unittest is downright weird.

It indeed never makes any sense to do it that way.

> However, I bet that if we changed it, _someone_ would complain. 
> Someone always does, even if the change makes perfect sense and 
> the previous behavior didn't.
>

Well obviously, but that's not a good reason.



More information about the Digitalmars-d mailing list