How can one reliably run unittests

Paul Backus snarwin at gmail.com
Wed Aug 25 13:25:22 UTC 2021


On Wednesday, 25 August 2021 at 13:23:22 UTC, wjoe wrote:
>
> But due to the fact that all unittests are compiled into one 
> callable, i.e. it's all in the same process, doesn't that mean 
> that after catching a throwable that the program is in UB ? And 
> isn't that the reason why the runtime unittester aborts on the 
> 1st failure ?
> So shouldn't it be like every module has its own callable which 
> can then run in separate processes which then wouldn't affect 
> others if one of them failed ? Also, that way all the modules 
> could be tested in parallel.

Errors thrown by assertions in unit tests are a special case:

> Individual tests are specified in the unit test using 
> AssertExpressions. Unlike AssertExpressions used elsewhere, the 
> assert is not assumed to hold, and upon assert failure the 
> program is still in a defined state.

Source: https://dlang.org/spec/unittest.html


More information about the Digitalmars-d mailing list