How can one reliably run unittests

deadalnix deadalnix at gmail.com
Thu Sep 2 18:35:48 UTC 2021


On Thursday, 2 September 2021 at 18:15:17 UTC, jfondren wrote:
> You want -run to treat the commandline completely differently 
> depending on whether -main has been passed? That would help you 
> to have not been surprised in this one case, but by making the 
> CLI more complex it's just going to be more confusing to more 
> people in the long run.
>

No.

I want a way to run the unitests in a set of module, and only 
these modules. I don't care about `-run`, `-main` or whatever. I 
care about the fact that there is no sensible combination of 
these flags that can achieve this.

> I just demonstrated compiling three modules to only test two of 
> them. This 7 pages long thread has all kinds of talk in it; it 
> is not full of people asking "I have these files; how do I run 
> only these tests in them?" or it'd be full of as many answers. 
> The machinery built up *around* testing is very good and can be 
> persuaded to work any way you want.

This is certainly possible. Nobody ever argued this wasn't 
possible. What was argued is that you pretty much have to rollout 
your own test framework to do this, and that it doesn't compose 
well when you import 3rd party code, which your demonstration 
confirms.

The machinery built around testing is absolutely not very good. 
You can claim it is, but the very fact that you have to raise 
scafolding that do not compose to do the most basic thing is a 
demonstration that it isn't. You simply can't argue with facts.

The fact is that all the functionality that are desired to do 
something sensible exist. There is just no way to plug them into 
each other in any sensible way because all the utilities and 
flags provided do some weird shit that is kinda useful but not 
really.


More information about the Digitalmars-d mailing list