How to unit-test behavior under "version"?

Andrey Zherikov andrey.zherikov at gmail.com
Wed Mar 30 00:57:39 UTC 2022


On Tuesday, 29 March 2022 at 20:20:46 UTC, Steven Schveighoffer 
wrote:
> So keep in mind that versions are *module-wide*, and usually 
> *compilation-wide*. Which means that you won't be testing 
> multiple version configurations in the same build.
>
> ...
>
> In the case where version is going to *affect the results of 
> the function*, as yours does above, then what I would do is 
> repeat the version tree as above, putting an individual 
> unittest in each branch. But you could potentially do it inside 
> the unittest itself. I just find that a bit convoluted.

Right, I can do per-version unit tests and the question becomes 
how to build&run all versions. Since I'm using dub, there is a 
way to express different versions through "configuration" specs 
in dub.json. Is there a way to tell `dub test` to test all 
configurations?



More information about the Digitalmars-d-learn mailing list