On Saturday, 12 December 2020 at 11:13:45 UTC, Tobias Pankrath wrote:
Whenever I come back to some D, I seem to be stumbling over dub. Somehow dub and I don't align:

$ dub init dubtest && cd dubtest
$ dub test
-> creates executable `dubtest` (saying Falling back to "dub -b unittest".)

$ touch source/lib.d
dub test
-> creates executable dubtest-test-library

Question is: How do I build the `dubtest-test-library` without running the tests?

If no explicit configuration is given, an existing "unittest" configuration will be preferred for testing. If none exists, the first library type configuration will be used, and if that doesn't exist either, the first executable configuration is chosen.

I've tried

$ dub test -b unittest -c library

but that re-creates ./dubtest not ./dubtest-test-library.

In any case you should have configurations in your dub json. For the first configuration, the name does not matter, it is used by default for command "dub" or "dub build", here you set targetType library. The second configuration you name unittest, you set targetType executable and you also have to set attribute mainSourceFile. This configuration is used automatically by command "dub test".

Kind regards
Andre

Reply via email to