digitalmars.D.learn - Project structure and unit tests
- Carlos Adriano Portes (18/18) Dec 19 2025 Hi,
- Carlos Adriano Portes (17/36) Dec 20 2025 The problem was solved, it turned out to be that I can't have the
- Andre (8/26) Dec 21 2025 Hi,
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
Dec 19 2025
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 PortesThe problem was solved, it turned out to be that I can't have the equivalent test modules I prefixed with "tests.". Another problem I am facing is that I am using package.d files to 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
Dec 20 2025
On Saturday, 20 December 2025 at 18:44:11 UTC, Carlos Adriano Portes wrote:On Saturday, 20 December 2025 at 01:29:12 UTC, Carlos Adriano Portes wrote:Hi, In case the framework d-unit is an option for you, this is the structure I use for my projects: https://andre2007.github.io/d-tips/dub/application_template/ Kind regards André[...]The problem was solved, it turned out to be that I can't have the equivalent test modules I prefixed with "tests.". Another problem I am facing is that I am using package.d files 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
Dec 21 2025








Andre <andre s-e-a-p.de>