On Saturday, 20 December 2025 at 01:29:12 UTC, Carlos Adriano Portes wrote:
Hi,

I am trying to create the following structure for a project using dub:

project
|--src
|--test

I am strugling to make this setup work, I would like to put all my unit tests (I am not using any testing library) on the test folder and reference code from src folder. I can run dub run and dub test successfully but dub test is not running any of the tests contained in the files under test folder. Tried multiple variations of the dub.json configuration with no success. If possible I would like to build for testing as a library.

Repository:
https://github.com/xcap2000/d-002

I am not a D expert, I am trying to learn when I have free time.

Kind regards,

Carlos Adriano Portes

The problem was solved, it turned out to be that I can't have the same module name in different files like C# namespaces, so the equivalent test modules I prefixed with "tests.".

Another problem I am facing is that I am using package.d files to kind of simulate namespaces in C#, and I added unit-threaded package to have a better output for the "dub test" output. It seems that unit-threaded did not like the way I am using packages and does not generate bin/ut.d file correctly.

I did a workaround by running "dub test", changing the generated bin/ut.d, chaging the dub.json to generate bin/ut2.d thus not overriding the one I changed. Whenever adding new packages will have to redo this work again.

Is anyone aware of this problem?

Kind regards,

Carlos Adriano Portes

Reply via email to