I do not know about conventions, but recently I found such a solution for DUB:
{ "name": "sample", "description": "sample app", "configurations": [ { "name": "application", "targetType": "executable", }, { "name": "unittest", "targetType": "executable", "targetPath" : "tests", "buildOptions": ["unittests"], "excludedSourceFiles": ["source/app.d"], "sourcePaths": ["tests/"], "importPaths": ["tests/"], "dependencies": { "dunit": ">=1.0.9" } } ] }
I found this idea in DUB sources . Now, if you run dub , the application will be created, and if you run dub test , unit tests (placed in tests/ ) will run.
This is not ideal, and I still have not worked, but it works for my simple needs.
One of the problems is that individual unit test modules do not have access to private elements in the sources (they can have access to the package and the public, though).
I'm not quite sure if there are any side effects of this configuration that I don't know about. Perhaps someone more experienced will test this approach.
emesx
source share