unit tests with name and verbose report

jmh530 john.michael.hall at gmail.com
Fri Aug 5 16:52:32 UTC 2022


On Friday, 5 August 2022 at 16:01:26 UTC, IGotD- wrote:
> On Thursday, 4 August 2022 at 20:01:00 UTC, jmh530 wrote:
>>
>> Just use version(newFeature) unittest {}
>
> Even if that would work, it is not an excuse for not 
> implementing named unittests.
>

What I discussed works and I use it all the time.

For instance, here:
https://github.com/libmir/mir-stat/blob/f61a82f741243c6054ad98e74a35a205b001931a/source/mir/stat/distribution/bernoulli.d#L36

And here is an example of the dub.sdl.
https://github.com/libmir/mir-stat/blob/f61a82f741243c6054ad98e74a35a205b001931a/dub.sdl#L10
You'll notice that I've commented out a line
//versions "mir_stat_test" "mir_stat_test_fp"
where the "mir_stat_test_fp" takes longer to run.

When I'm developing new features, I just create a new 
"mir_stat_test_newFeature" and comment out the "mir_stat_test" 
one. As you said, this lets me run these new UTs without running 
the rest of them. That's basically the feature that you want to 
use named unittests for.

Before I commit, I replace the "mir_stat_test_newFeature" to 
"mir_stat_test" and make sure tests pass for everything.

> This one of the things I dislike with the D project, low 
> hanging fruit and obvious helpful features that never gets 
> implemented.

There's something to be said for orthogonal features...


More information about the Digitalmars-d mailing list