Phobos Unittest

Paul Backus snarwin at gmail.com
Sat Sep 4 03:18:01 UTC 2021


On Saturday, 4 September 2021 at 00:09:37 UTC, H. S. Teoh wrote:
> This is related to the bogonity of the current behaviour of 
> -unittest, which compiles *all* unittests of *all* imported 
> modules, even when you're compiling user code that has no 
> interest in Phobos unittests.

Well, no; it compiles all unittests of all *compiled* modules, 
not all *imported* modules. So it does not actually include 
Phobos unittests.

> StdUnittest is a hack introduced to suppress Phobos unittests 
> in user programs.

The point of `StdUnittest` is to suppress

* `version (unittest)` blocks in Phobos
* Phobos unittests in the bodies of templates that are 
instantiated by user code

As Steven Schveighoffer [pointed out][1], Phobos unittests are 
never included in user code, regardless of whether `StdUnittest` 
is used.

[1]: https://forum.dlang.org/post/sglmk0$33m$1@digitalmars.com


More information about the Digitalmars-d-learn mailing list