Thread overview
Is it normal that unittests of phobos are executed with my project build?
Jun 14, 2014
Xavier Bigand
Jun 16, 2014
Dicebot
June 14, 2014
I get a failure on a test in format.d when I build my own project with unittest. I though importing phobos header would not regenerate their unittest modules.

Any idea of what can cause this issue? I already have reinstalled dmd with visualD completely.
June 16, 2014
On Sat, 14 Jun 2014 10:32:04 -0400, Xavier Bigand <flamaros.xavier@gmail.com> wrote:

> I get a failure on a test in format.d when I build my own project with unittest. I though importing phobos header would not regenerate their unittest modules.
>
> Any idea of what can cause this issue? I already have reinstalled dmd with visualD completely.

Templates are not compiled fully until you use them.

If a unit test is inside a template, and that template wasn't instantiated inside phobos itself (likely for formatting), it will be instantiated, unit test and all, inside your code that used it.

This is a big limitation on the unit test system. There is no way to say what unit tests to enable, and what to disable. It's just all or nothing.

-Steve
June 16, 2014
On Saturday, 14 June 2014 at 14:32:10 UTC, Xavier Bigand wrote:
> I get a failure on a test in format.d when I build my own project with unittest. I though importing phobos header would not regenerate their unittest modules.
>
> Any idea of what can cause this issue? I already have reinstalled dmd with visualD completely.

Quite likely that you use rdmd. It compiles dependencies with same flags as main target so if you do `rdmd -unittest app.d` all modules app imports will be compiled with `-unittest` as well. Using custom build process can fix it.