unittests and imported modules

H. S. Teoh hsteoh at quickfur.ath.cx
Fri Jan 29 03:24:50 UTC 2021


To answer your other question:

On Thu, Jan 28, 2021 at 07:44:59PM +0000, kdevel via Digitalmars-d-learn wrote:
[...]
> After inserting print statements into the other modules I found that
> the additional four unittests originate from the imported files. Is
> there a trick to get only the unittest from <filename> run other than
> dropping the "-i" and specifiying the other object files on the
> command line?

AFAIK it's currently not possible with the built-in test runner. But
there are dub packages for replacement test runners that may offer this
functionality.


> And why are the unittests from the imported phobos functions not run?

Phobos was hacked to only run unittests when StdUnittest is defined.
It's a workaround for the lameness that unittests from *all* imported
modules are run with a -unittest build, including from external modules
and libraries you may not be concerned with.


T

-- 
The easy way is the wrong way, and the hard way is the stupid way. Pick one.


More information about the Digitalmars-d-learn mailing list